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

user_status_tooltip.rb « concerns « serializers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fcf6700cb59fa443f3a192865135822cac6d0ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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