diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/models/award_emoji.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/models/award_emoji.rb')
-rw-r--r-- | app/models/award_emoji.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/award_emoji.rb b/app/models/award_emoji.rb index b665f3d5d8c..22e5436dc5c 100644 --- a/app/models/award_emoji.rb +++ b/app/models/award_emoji.rb @@ -19,6 +19,8 @@ class AwardEmoji < ApplicationRecord participant :user + delegate :resource_parent, to: :awardable, allow_nil: true + scope :downvotes, -> { named(DOWNVOTE_NAME) } scope :upvotes, -> { named(UPVOTE_NAME) } scope :named, -> (names) { where(name: names) } @@ -60,6 +62,12 @@ class AwardEmoji < ApplicationRecord self.name == UPVOTE_NAME end + def url + return if TanukiEmoji.find_by_alpha_code(name) + + CustomEmoji.for_resource(resource_parent).by_name(name).select(:url).first&.url + end + def expire_cache awardable.try(:bump_updated_at) awardable.try(:expire_etag_cache) |