mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-29 20:13:27 +00:00
Fix rendering assignee changed comments without assignee (#27927)
When an assignee changed event comment is rendered, most of it is guarded behind the assignee ID not being 0. However, if it is 0, that results in quite broken rendering for that comment and the next one. This can happen, for example, when repository data imported from outside of Gitea is incomplete. This PR makes sure comments with an assignee ID of 0 are not rendered at all. --- Screenshot before: <img width="272" alt="Bildschirmfoto 2023-11-05 um 20 12 18" src="https://github.com/go-gitea/gitea/assets/42910/7d629d76-fee4-4fe5-9e3a-bf524050cead"> The comments in this screenshot are: 1. A regular text comment 2. A user being unassigned 3. A user being assigned 4. The title of the PR being changed Comments 2 and 3 are rendered without any text, which indents the next comment and does not leave enough vertical space. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
3a924fdc83
commit
e80f446d3a
|
@ -4,7 +4,8 @@
|
||||||
{{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}
|
{{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}
|
||||||
|
|
||||||
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
|
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
|
||||||
5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
|
5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 8 = MILESTONE_CHANGE,
|
||||||
|
9 = ASSIGNEES_CHANGE, 10 = TITLE_CHANGE, 11 = DELETE_BRANCH, 12 = START_TRACKING,
|
||||||
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
||||||
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
||||||
22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
|
22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
|
||||||
|
@ -184,31 +185,29 @@
|
||||||
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{ctx.Locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}}
|
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{ctx.Locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 9}}
|
{{else if and (eq .Type 9) (gt .AssigneeID 0)}}
|
||||||
<div class="timeline-item event" id="{{.HashTag}}">
|
<div class="timeline-item event" id="{{.HashTag}}">
|
||||||
<span class="badge">{{svg "octicon-person"}}</span>
|
<span class="badge">{{svg "octicon-person"}}</span>
|
||||||
{{if gt .AssigneeID 0}}
|
{{if .RemovedAssignee}}
|
||||||
{{if .RemovedAssignee}}
|
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
||||||
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
<span class="text grey muted-links">
|
||||||
<span class="text grey muted-links">
|
{{template "shared/user/authorlink" .Assignee}}
|
||||||
{{template "shared/user/authorlink" .Assignee}}
|
{{if eq .Poster.ID .Assignee.ID}}
|
||||||
{{if eq .Poster.ID .Assignee.ID}}
|
{{ctx.Locale.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}}
|
||||||
{{ctx.Locale.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}}
|
{{else}}
|
||||||
{{else}}
|
{{ctx.Locale.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
||||||
{{ctx.Locale.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
{{end}}
|
||||||
{{end}}
|
</span>
|
||||||
</span>
|
{{else}}
|
||||||
{{else}}
|
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
||||||
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
<span class="text grey muted-links">
|
||||||
<span class="text grey muted-links">
|
{{template "shared/user/authorlink" .Assignee}}
|
||||||
{{template "shared/user/authorlink" .Assignee}}
|
{{if eq .Poster.ID .AssigneeID}}
|
||||||
{{if eq .Poster.ID .AssigneeID}}
|
{{ctx.Locale.Tr "repo.issues.self_assign_at" $createdStr | Safe}}
|
||||||
{{ctx.Locale.Tr "repo.issues.self_assign_at" $createdStr | Safe}}
|
{{else}}
|
||||||
{{else}}
|
{{ctx.Locale.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
||||||
{{ctx.Locale.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
|
{{end}}
|
||||||
{{end}}
|
</span>
|
||||||
</span>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 10}}
|
{{else if eq .Type 10}}
|
||||||
|
|
Loading…
Reference in a new issue