mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Refactor commentTags functionality (#17558)
* feat: Allow multiple tags on comments - Allow for multiples tags(Currently Poster + {Owner, Writer}). - Utilize the Poster tag within the commentTag function and remove the checking from templates. - Use bitwise on CommentTags to enable specific tags. - Don't show poster tag(view_content.tmpl) on the initial issue comment. * Change parameters naming * Change function name * refactor variable wording * Merge 'master' branch into 'tags-comments' branch * Change naming * `tag` -> `role` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
a4dc0c5a82
commit
492e1c2fbd
5 changed files with 112 additions and 75 deletions
|
@ -44,18 +44,19 @@
|
|||
</div>
|
||||
<div class="comment-header-right actions df ac">
|
||||
{{if not $.Repository.IsArchived}}
|
||||
{{if or (and (eq .PosterID .Issue.PosterID) (eq .Issue.OriginalAuthorID 0)) (and (eq .Issue.OriginalAuthorID .OriginalAuthorID) (not (eq .OriginalAuthorID 0))) }}
|
||||
{{if (.ShowRole.HasRole "Poster")}}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.poster"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if gt .ShowTag 0}}
|
||||
{{if (.ShowRole.HasRole "Writer")}}
|
||||
<div class="ui basic label">
|
||||
{{if eq .ShowTag 2}}
|
||||
{{$.i18n.Tr "repo.issues.collaborator"}}
|
||||
{{else if eq .ShowTag 3}}
|
||||
{{$.i18n.Tr "repo.issues.owner"}}
|
||||
{{end}}
|
||||
{{$.i18n.Tr "repo.issues.collaborator"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if (.ShowRole.HasRole "Owner")}}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.owner"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
|
||||
|
@ -549,24 +550,23 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="comment-header-right actions df ac">
|
||||
{{if not $.Repository.IsArchived}}
|
||||
{{if or (and (eq .PosterID $.Issue.PosterID) (eq $.Issue.OriginalAuthorID 0)) (eq $.Issue.OriginalAuthorID .OriginalAuthorID) }}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.poster"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if gt .ShowTag 0}}
|
||||
<div class="ui basic label">
|
||||
{{if eq .ShowTag 2}}
|
||||
{{$.i18n.Tr "repo.issues.collaborator"}}
|
||||
{{else if eq .ShowTag 3}}
|
||||
{{$.i18n.Tr "repo.issues.owner"}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{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 "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
|
||||
{{if (.ShowRole.HasRole "Poster")}}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.poster"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if (.ShowRole.HasRole "Writer")}}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.collaborator"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if (.ShowRole.HasRole "Owner")}}
|
||||
<div class="ui basic label">
|
||||
{{$.i18n.Tr "repo.issues.owner"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{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 "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text comment-content">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue