diff --git a/app/assets/stylesheets/common/base/onebox.scss b/app/assets/stylesheets/common/base/onebox.scss
index c40dd3e2dd4..fdaf1f6a2b6 100644
--- a/app/assets/stylesheets/common/base/onebox.scss
+++ b/app/assets/stylesheets/common/base/onebox.scss
@@ -505,6 +505,11 @@ pre.onebox code {
color: var(--secondary) !important;
padding: 2px 4px !important;
}
+
+ .emoji {
+ max-height: 15px;
+ margin: 0.2em;
+ }
}
.onebox.githubactions {
diff --git a/app/helpers/emoji_helper.rb b/app/helpers/emoji_helper.rb
index fcf0462f349..3e3e59c7787 100644
--- a/app/helpers/emoji_helper.rb
+++ b/app/helpers/emoji_helper.rb
@@ -2,21 +2,6 @@
module EmojiHelper
def emoji_codes_to_img(str)
- return if str.blank?
-
- str = str.gsub(/:([\w\-+]*(?::t\d)?):/) do |name|
- code = $1
-
- if code && Emoji.custom?(code)
- emoji = Emoji[code]
- ""
- elsif code && Emoji.exists?(code)
- "
"
- else
- name
- end
- end
-
- raw(str)
+ raw(Emoji.codes_to_img(str))
end
end
diff --git a/app/models/emoji.rb b/app/models/emoji.rb
index 4a9012c3071..f755a7eaadf 100644
--- a/app/models/emoji.rb
+++ b/app/models/emoji.rb
@@ -231,4 +231,20 @@ class Emoji
@unicode_replacements_json ||= unicode_replacements.to_json
end
+ def self.codes_to_img(str)
+ return if str.blank?
+
+ str = str.gsub(/:([\w\-+]*(?::t\d)?):/) do |name|
+ code = $1
+
+ if code && Emoji.custom?(code)
+ emoji = Emoji[code]
+ "
"
+ elsif code && Emoji.exists?(code)
+ "
"
+ else
+ name
+ end
+ end
+ end
end
diff --git a/lib/onebox/engine/github_issue_onebox.rb b/lib/onebox/engine/github_issue_onebox.rb
index 0bb26b70ac2..4d387f47995 100644
--- a/lib/onebox/engine/github_issue_onebox.rb
+++ b/lib/onebox/engine/github_issue_onebox.rb
@@ -31,19 +31,23 @@ module Onebox
body, excerpt = compute_body(raw['body'])
ulink = URI(link)
+ labels = raw['labels'].map do |l|
+ { name: Emoji.codes_to_img(l['name']) }
+ end
+
{
link: @url,
- title: raw["title"],
+ title: raw['title'],
body: body,
excerpt: excerpt,
- labels: raw["labels"],
+ labels: labels,
user: raw['user'],
- created_at: created_at.strftime("%I:%M%p - %d %b %y %Z"),
- created_at_date: created_at.strftime("%F"),
- created_at_time: created_at.strftime("%T"),
- closed_at: closed_at&.strftime("%I:%M%p - %d %b %y %Z"),
- closed_at_date: closed_at&.strftime("%F"),
- closed_at_time: closed_at&.strftime("%T"),
+ created_at: created_at.strftime('%I:%M%p - %d %b %y %Z'),
+ created_at_date: created_at.strftime('%F'),
+ created_at_time: created_at.strftime('%T'),
+ closed_at: closed_at&.strftime('%I:%M%p - %d %b %y %Z'),
+ closed_at_date: closed_at&.strftime('%F'),
+ closed_at_time: closed_at&.strftime('%T'),
closed_by: raw['closed_by'],
avatar: "https://avatars1.githubusercontent.com/u/#{raw['user']['id']}?v=2&s=96",
domain: "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}",
diff --git a/lib/onebox/templates/githubissue.mustache b/lib/onebox/templates/githubissue.mustache
index f8766736b34..54989581c0f 100644
--- a/lib/onebox/templates/githubissue.mustache
+++ b/lib/onebox/templates/githubissue.mustache
@@ -29,7 +29,9 @@