diff options
author | Rémy Coutable <remy@rymai.me> | 2018-08-01 18:21:24 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-08-01 18:21:24 +0300 |
commit | 83a0db0c551236518bdec1a7ae3a1ed1d05f5aaa (patch) | |
tree | e13ad022ea223e7bde5202a31ee81169225fec99 /app/serializers | |
parent | ea6fc714bb0306ac8ca56b5dafe4b6777aafe5fc (diff) | |
parent | 12095251c3777c5231cab97854d5dca69d31cc5d (diff) |
Merge branch 'bvl-user-status-message-35463' into 'master'
Allow users to set a status
Closes #35463
See merge request gitlab-org/gitlab-ce!20614
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/concerns/user_status_tooltip.rb | 19 | ||||
-rw-r--r-- | app/serializers/user_entity.rb | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/app/serializers/concerns/user_status_tooltip.rb b/app/serializers/concerns/user_status_tooltip.rb new file mode 100644 index 00000000000..aa6e67e3351 --- /dev/null +++ b/app/serializers/concerns/user_status_tooltip.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module UserStatusTooltip + extend ActiveSupport::Concern + include ActionView::Helpers::TagHelper + include ActionView::Context + include EmojiHelper + include UsersHelper + + included do + expose :user_status_if_loaded, as: :status_tooltip_html + + def user_status_if_loaded + return nil unless object.association(:status).loaded? + + user_status(object) + end + end +end diff --git a/app/serializers/user_entity.rb b/app/serializers/user_entity.rb index 6236d66ff4a..656900bb8af 100644 --- a/app/serializers/user_entity.rb +++ b/app/serializers/user_entity.rb @@ -2,6 +2,7 @@ class UserEntity < API::Entities::UserBasic include RequestAwareEntity + include UserStatusTooltip expose :path do |user| user_path(user) |