diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/services/users | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/approve_service.rb | 8 | ||||
-rw-r--r-- | app/services/users/set_status_service.rb | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/services/users/approve_service.rb b/app/services/users/approve_service.rb index 228cfbd6947..27668e9430e 100644 --- a/app/services/users/approve_service.rb +++ b/app/services/users/approve_service.rb @@ -15,7 +15,9 @@ module Users # Please see Devise's implementation of `resend_confirmation_instructions` for detail. user.resend_confirmation_instructions user.accept_pending_invitations! if user.active_for_authentication? + DeviseMailer.user_admin_approval(user).deliver_later + after_approve_hook(user) success else error(user.errors.full_messages.uniq.join('. ')) @@ -26,6 +28,10 @@ module Users attr_reader :current_user + def after_approve_hook(user) + # overridden by EE module + end + def allowed? can?(current_user, :approve_user) end @@ -35,3 +41,5 @@ module Users end end end + +Users::ApproveService.prepend_if_ee('EE::Users::ApproveService') diff --git a/app/services/users/set_status_service.rb b/app/services/users/set_status_service.rb index 89008368d5f..356c8782af1 100644 --- a/app/services/users/set_status_service.rb +++ b/app/services/users/set_status_service.rb @@ -14,7 +14,7 @@ module Users def execute return false unless can?(current_user, :update_user_status, target_user) - if params[:emoji].present? || params[:message].present? + if params[:emoji].present? || params[:message].present? || params[:availability].present? set_status else remove_status @@ -25,6 +25,9 @@ module Users def set_status params[:emoji] = UserStatus::DEFAULT_EMOJI if params[:emoji].blank? + params.delete(:availability) if params[:availability].blank? + return false if params[:availability].present? && UserStatus.availabilities.keys.exclude?(params[:availability]) + user_status.update(params) end |