mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08: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:
		@@ -49,14 +49,17 @@
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="comment-header-right actions df ac">
 | 
			
		||||
							{{if not $.Repository.IsArchived}}
 | 
			
		||||
								{{if gt .Issue.ShowTag 0}}
 | 
			
		||||
									<div class="ui basic label">
 | 
			
		||||
										{{if eq .Issue.ShowTag 2}}
 | 
			
		||||
								{{if gt .Issue.ShowRole 0}}
 | 
			
		||||
									{{if (.Issue.ShowRole.HasRole "Writer")}}
 | 
			
		||||
										<div class="ui basic label">
 | 
			
		||||
											{{$.i18n.Tr "repo.issues.collaborator"}}
 | 
			
		||||
										{{else if eq .Issue.ShowTag 3}}
 | 
			
		||||
										</div>
 | 
			
		||||
									{{end}}
 | 
			
		||||
									{{if (.Issue.ShowRole.HasRole "Owner")}}
 | 
			
		||||
										<div class="ui basic label">
 | 
			
		||||
											{{$.i18n.Tr "repo.issues.owner"}}
 | 
			
		||||
										{{end}}
 | 
			
		||||
									</div>
 | 
			
		||||
										</div>
 | 
			
		||||
									{{end}}
 | 
			
		||||
								{{end}}
 | 
			
		||||
								{{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 "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
 | 
			
		||||
 
 | 
			
		||||
@@ -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">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user