From a2683e5ddb65c4fb4455872cbf377b59dba14f86 Mon Sep 17 00:00:00 2001 From: mrsdizzie Date: Thu, 30 Apr 2020 04:10:15 -0400 Subject: [PATCH] Allow emoji short code in labels (#11250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow emoji short code in labels As title, turn :alias: type short code into emojis when rendering labels to match previous behavior * Update models/issue_label.go Co-Authored-By: John Olheiser * render text in templates not code * remove has-emoji class 🧙‍♀️ * fix new issue form Co-authored-by: John Olheiser Co-authored-by: Lunny Xiao --- templates/repo/issue/labels/label_list.tmpl | 5 ++--- templates/repo/issue/list.tmpl | 8 ++++---- templates/repo/issue/new_form.tmpl | 12 ++++++------ templates/repo/issue/view_content/comments.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 12 ++++++------ templates/user/dashboard/issues.tmpl | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index ce33d76fc..5692f36d2 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -31,7 +31,7 @@
  • -
    {{svg "octicon-tag" 16}} {{.Name}}
    +
    {{svg "octicon-tag" 16}} {{.Name | RenderEmojiPlain}}
    @@ -74,7 +74,7 @@
  • -
    {{svg "octicon-tag" 16}} {{.Name}}
    +
    {{svg "octicon-tag" 16}} {{.Name | RenderEmojiPlain}}
    @@ -94,4 +94,3 @@ {{end}}
    - diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index cebcb7da6..dbfee8480 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -51,7 +51,7 @@ {{.i18n.Tr "repo.issues.filter_label_exclude" | Safe}} {{.i18n.Tr "repo.issues.filter_label_no_select"}} {{range .Labels}} - {{if .IsExcluded}}{{svg "octicon-circle-slash" 16}}{{else if .IsSelected}}{{svg "octicon-check" 16}}{{end}} {{.Name}} + {{if .IsExcluded}}{{svg "octicon-circle-slash" 16}}{{else if .IsSelected}}{{svg "octicon-check" 16}}{{end}} {{.Name | RenderEmojiPlain}} {{end}}
    @@ -154,8 +154,8 @@ {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 941141b55..2c355a9c0 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -111,13 +111,13 @@
    {{.i18n.Tr "repo.issues.new.clear_labels"}}
    {{if or .Labels .OrgLabels}} {{range .Labels}} - {{svg "octicon-check" 16}} {{.Name}} - {{if .Description }}
    {{.Description}}{{end}}
    + {{svg "octicon-check" 16}} {{.Name | RenderEmojiPlain}} + {{if .Description }}
    {{.Description | RenderEmojiPlain}}{{end}}
    {{end}}
    {{range .OrgLabels}} - {{svg "octicon-check" 16}} {{.Name}} - {{if .Description }}
    {{.Description}}{{end}}
    + {{svg "octicon-check" 16}} {{.Name | RenderEmojiPlain}} + {{if .Description }}
    {{.Description | RenderEmojiPlain}}{{end}}
    {{end}} {{else}}
    {{.i18n.Tr "repo.issues.new.no_items"}}
    @@ -128,12 +128,12 @@ {{.i18n.Tr "repo.issues.new.no_label"}} {{range .Labels}} {{end}} {{range .OrgLabels}} {{end}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 92e87da0a..5d8bc327e 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -123,7 +123,7 @@ especially on mobile views. */}} {{range .}} - {{.Name}} + {{.Name | RenderEmojiPlain}} {{end}} {{end}}