mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
FEATURE: Render emojis on GitHub labels when oneboxing an issue. (#13531)
This commit is contained in:
@ -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]}",
|
||||
|
@ -29,7 +29,9 @@
|
||||
|
||||
<div class="labels">
|
||||
{{#labels}}
|
||||
<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">{{name}}</span>
|
||||
<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
|
||||
{{{name}}}
|
||||
</span>
|
||||
{{/labels}}
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user