gitlab-org--gitlab-foss/app/serializers/concerns/user_status_tooltip.rb

26 lines
519 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module UserStatusTooltip
extend ActiveSupport::Concern
include ActionView::Helpers::TagHelper
include ActionView::Context
include EmojiHelper
include UsersHelper
included do
expose :status_tooltip_html, if: -> (*) { status_loaded? } do |user|
user_status(user)
end
expose :show_status do |user|
status_loaded? && show_status_emoji?(user.status)
end
private
def status_loaded?
object.association(:status).loaded?
end
end
end