mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 13:25:36 +03:00
[Fix] AllowedReaction code (#9518)
* optimize * CI.restart() Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
e64880ef07
commit
4ee97465e9
8 changed files with 11 additions and 10 deletions
|
@ -81,6 +81,9 @@ func NewFuncMap() []template.FuncMap {
|
|||
"LoadTimes": func(startTime time.Time) string {
|
||||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||
},
|
||||
"AllowedReactions": func() []string {
|
||||
return setting.UI.Reactions
|
||||
},
|
||||
"AvatarLink": base.AvatarLink,
|
||||
"Safe": Safe,
|
||||
"SafeJS": SafeJS,
|
||||
|
|
|
@ -705,7 +705,6 @@ func ViewIssue(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
ctx.Data["IssueWatch"] = iw
|
||||
ctx.Data["AllowedReactions"] = setting.UI.Reactions
|
||||
|
||||
issue.RenderedContent = string(markdown.Render([]byte(issue.Content), ctx.Repo.RepoLink,
|
||||
ctx.Repo.Repository.ComposeMetas()))
|
||||
|
|
|
@ -423,7 +423,6 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
|
|||
|
||||
ctx.Data["NumCommits"] = compareInfo.Commits.Len()
|
||||
ctx.Data["NumFiles"] = compareInfo.NumFiles
|
||||
ctx.Data["AllowedReactions"] = setting.UI.Reactions
|
||||
return compareInfo
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{{$reactions := .Reactions.GroupByType}}
|
||||
{{if $reactions}}
|
||||
<div class="ui attached segment reactions">
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions "AllowedReactions" $.AllowedReactions }}
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
{{end}}
|
||||
{{if not $.Repository.IsArchived}}
|
||||
<div class="ui right actions">
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "AllowedReactions" $.AllowedReactions}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
|
||||
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false }}
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -47,7 +47,7 @@
|
|||
{{$reactions := .Issue.Reactions.GroupByType}}
|
||||
{{if $reactions}}
|
||||
<div class="ui attached segment reactions">
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions "AllowedReactions" $.AllowedReactions}}
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Issue.Attachments}}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="menu has-emoji">
|
||||
<div class="header">{{ .ctx.i18n.Tr "repo.pick_reaction"}}</div>
|
||||
<div class="divider"></div>
|
||||
{{range $value := .AllowedReactions}}
|
||||
{{range $value := AllowedReactions}}
|
||||
{{if eq $value "hooray"}}
|
||||
<div class="item" data-content="hooray">:tada:</div>
|
||||
{{else if eq $value "laugh"}}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "AllowedReactions" $.AllowedReactions}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
|
||||
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false }}
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -56,7 +56,7 @@
|
|||
{{$reactions := .Reactions.GroupByType}}
|
||||
{{if $reactions}}
|
||||
<div class="ui attached segment reactions">
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions "AllowedReactions" $.AllowedReactions}}
|
||||
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Attachments}}
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
{{len $value}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if $.AllowedReactions}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.ctx "ActionURL" .ActionURL "AllowedReactions" $.AllowedReactions}}
|
||||
{{if AllowedReactions}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.ctx "ActionURL" .ActionURL}}
|
||||
{{end}}
|
||||
|
|
Loading…
Reference in a new issue