debian-mirror-gitlab/app/serializers/concerns/user_status_tooltip.rb

26 lines
519 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
module UserStatusTooltip
extend ActiveSupport::Concern
include ActionView::Helpers::TagHelper
2020-03-13 15:44:24 +05:30
include ActionView::Context
2018-11-18 11:00:15 +05:30
include EmojiHelper
include UsersHelper
included do
2021-02-22 17:27:13 +05:30
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
2018-11-18 11:00:15 +05:30
2021-02-22 17:27:13 +05:30
private
2018-11-18 11:00:15 +05:30
2021-02-22 17:27:13 +05:30
def status_loaded?
object.association(:status).loaded?
2018-11-18 11:00:15 +05:30
end
end
end