Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/users/set_status_service.rb')
-rw-r--r--app/services/users/set_status_service.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/services/users/set_status_service.rb b/app/services/users/set_status_service.rb
index 2b4be8c833b..d0bb40cbcfb 100644
--- a/app/services/users/set_status_service.rb
+++ b/app/services/users/set_status_service.rb
@@ -28,11 +28,12 @@ module Users
params[:emoji] = UserStatus::DEFAULT_EMOJI if params[:emoji].blank?
params[:availability] = UserStatus.availabilities[:not_set] unless new_user_availability
- user_status.update(params)
+ bump_user if user_status.update(params)
end
def remove_status
- UserStatus.delete(target_user.id)
+ bump_user if UserStatus.delete(target_user.id).nonzero?
+ true
end
def user_status
@@ -48,5 +49,12 @@ module Users
def new_user_availability
UserStatus.availabilities[params[:availability]]
end
+
+ def bump_user
+ # Intentionally not calling `touch` as that will trigger other callbacks
+ # on target_user (e.g. after_touch, after_commit, after_rollback) and we
+ # don't need them to happen here.
+ target_user.update_column(:updated_at, Time.current)
+ end
end
end