* Fix weird breakpoint top-nav issue * Fix error handling when submitting blank note * Change status closed to invalid * Add ability to sort between status * WIP * Add working views for new report page * Add mailer WIP * Add MVP of new reports system * Move collapse to the right & add show page link * Fix buttons for index page * Change collapse to collapse/expand * Remove email functionality from new report * Update copy of report abuse responses * WIP of showing emails in reports * Fix notes for user_role_service.rb * Remove unused scripts from internal.html.erb * Update tests for reports dashboard * Add missing migration file * Add finishing touches to reports dashboard * Remove deprecated methods * Update view with better timestamps * Update and write new tests * Add .codeclimate.yml * Remove commented out editor thing * Undo commented out code for recaptcha method * Undo comment out code for development * Use new comment path instead of old comment path
68 lines
2.4 KiB
Ruby
68 lines
2.4 KiB
Ruby
module Admin
|
|
class UsersController < Admin::ApplicationController
|
|
def update
|
|
user = User.find(params[:id])
|
|
UserRoleService.new(user, current_user.id).check_for_roles(params[:user])
|
|
if user.errors.messages.blank? && user.update(user_params)
|
|
flash[:notice] = "User successfully updated"
|
|
redirect_to "/admin/users/#{params[:id]}"
|
|
else
|
|
render :new, locals: { page: Administrate::Page::Form.new(dashboard, user) }
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def user_params
|
|
accessible = %i[name
|
|
email
|
|
username
|
|
twitter_username
|
|
github_username
|
|
profile_image
|
|
website_url
|
|
summary
|
|
email_newsletter
|
|
email_comment_notifications
|
|
email_follower_notifications
|
|
organization_id
|
|
org_admin
|
|
bg_color_hex
|
|
text_color_hex
|
|
employer_name
|
|
employer_url
|
|
employment_title
|
|
currently_learning
|
|
available_for
|
|
mostly_work_with
|
|
currently_hacking_on
|
|
location
|
|
email_public
|
|
education
|
|
looking_for_work
|
|
looking_for_work_publicly
|
|
contact_consent
|
|
feed_url
|
|
feed_mark_canonical
|
|
feed_admin_publish_permission
|
|
reputation_modifier
|
|
onboarding_package_requested
|
|
onboarding_package_fulfilled
|
|
onboarding_package_requested_again
|
|
shipping_name
|
|
shipping_company
|
|
shipping_address
|
|
shipping_address_line_2
|
|
shipping_city
|
|
shipping_state
|
|
shipping_country
|
|
shipping_postal_code
|
|
shirt_size
|
|
shirt_gender
|
|
saw_onboarding
|
|
scholar_email]
|
|
accessible << %i[password password_confirmation] unless params[:user][:password].blank?
|
|
params.require(:user).permit(accessible)
|
|
end
|
|
end
|
|
end
|