diff options
author | zeripath <art27@cantab.net> | 2022-09-03 10:33:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-03 10:33:34 +0100 |
commit | de7b87fbc238e0685c01cb26a580b3d21cee623a (patch) | |
tree | b2bc27a5e219853c8e53ed0a6f2abf23b02aede4 /templates | |
parent | 18046eb91e21e03d475f3990e59516b46b6f67e2 (diff) | |
download | gitea-de7b87fbc238e0685c01cb26a580b3d21cee623a.tar.gz gitea-de7b87fbc238e0685c01cb26a580b3d21cee623a.zip |
Do not add links to Posters or Assignees with ID < 0 (#20577)
There are several places in templates/repo/issue/view_content/comments.tmpl where links are made to Posters or Assignees who are Ghosts or have IDs <0.
Fix #20559
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/org/team/teams.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/diff/comments.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 179 | ||||
-rw-r--r-- | templates/shared/user/authorlink.tmpl | 3 | ||||
-rw-r--r-- | templates/shared/user/avatarlink.tmpl | 3 | ||||
-rw-r--r-- | templates/shared/user/namelink.tmpl | 3 |
7 files changed, 76 insertions, 128 deletions
diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 465701d96e..5399f3a594 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -32,9 +32,7 @@ </div> <div class="ui attached segment members"> {{range .Members}} - <a href="{{.HomeLink}}" title="{{.Name}}"> - {{avatar .}} - </a> + {{template "shared/user/avatarlink" .}} {{end}} </div> <div class="ui bottom attached header"> diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 0cc7853378..5d298f820c 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -5,9 +5,7 @@ {{if .OriginalAuthor}} <span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span> {{else}} - <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} {{end}} <div class="content comment-container"> <div class="ui top attached header comment-header df ac sb"> @@ -27,9 +25,7 @@ </span> {{else}} <span class="text grey"> - <a {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> - {{.Poster.GetDisplayName}} - </a> + {{template "shared/user/namelink" .Poster}} {{$.root.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} </span> {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 91a523a1e2..ed1fd4778f 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -8,9 +8,7 @@ <div class="twelve wide column"> <div class="ui comments"> <div class="comment"> - <a class="avatar" href="{{.SignedUser.HomeLink}}"> - {{avatar .SignedUser}} - </a> + {{template "shared/user/avatarlink" .SignedUser}} <div class="ui segment content"> <div class="field"> <input name="title" id="issue_title" placeholder="{{.locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" tabindex="3" autofocus required maxlength="255" autocomplete="off"> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index e33981a012..8e0308c2d0 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -17,7 +17,7 @@ {{if .OriginalAuthor}} <span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span> {{else}} - <a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> + <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> {{avatar .Poster}} </a> {{end}} @@ -96,11 +96,9 @@ {{else if eq .Type 1}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge bg-green text-white">{{svg "octicon-dot-fill"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if .Issue.IsPull}} {{$.locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}} {{else}} @@ -111,11 +109,9 @@ {{else if eq .Type 2}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge bg-red text-white">{{svg "octicon-circle-slash"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if .Issue.IsPull}} {{$.locale.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}} {{else}} @@ -126,11 +122,9 @@ {{else if eq .Type 28}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge bg-purple text-white">{{svg "octicon-git-merge"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$link := printf "%s/commit/%s" $.Repository.HTMLURL ($.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} @@ -155,12 +149,10 @@ {{$createdStr:= TimeSinceUnix .CreatedUnix $.locale}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-bookmark"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} {{if eq .RefAction 3}}<del>{{end}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr $refTr (.EventTag|Escape) $createdStr (.RefCommentHTMLURL|Escape) $refFrom | Safe}} </span> {{if eq .RefAction 3}}</del>{{end}} @@ -172,11 +164,9 @@ {{else if eq .Type 4}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-bookmark"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}} </span> <div class="detail"> @@ -188,11 +178,9 @@ {{if or .AddedLabels .RemovedLabels}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-tag"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if and .AddedLabels (not .RemovedLabels)}} {{$.locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels) $createdStr | Safe}} {{else if and (not .AddedLabels) .RemovedLabels}} @@ -206,11 +194,9 @@ {{else if eq .Type 8}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-milestone"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}} </span> </div> @@ -219,11 +205,9 @@ <span class="badge">{{svg "octicon-person"}}</span> {{if gt .AssigneeID 0}} {{if .RemovedAssignee}} - <a href="{{.Assignee.HomeLink}}"> - {{avatar .Assignee}} - </a> + {{template "shared/user/avatarlink" .Assignee}} <span class="text grey"> - <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> + <a class="author" {{if gt .Assignee.ID 0}}href="{{.Assignee.HomeLink}}"{{end}}>{{.Assignee.GetDisplayName}}</a> {{if eq .Poster.ID .Assignee.ID}} {{$.locale.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}} {{else}} @@ -231,11 +215,9 @@ {{end}} </span> {{else}} - <a href="{{.Assignee.HomeLink}}"> - {{avatar .Assignee}} - </a> + {{template "shared/user/avatarlink" .Assignee}} <span class="text grey"> - <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Assignee}} {{if eq .Poster.ID .AssigneeID}} {{$.locale.Tr "repo.issues.self_assign_at" $createdStr | Safe}} {{else}} @@ -248,44 +230,36 @@ {{else if eq .Type 10}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-pencil"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} </span> </div> {{else if eq .Type 11}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}} </span> </div> {{else if eq .Type 12}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.start_tracking_history" $createdStr | Safe}} </span> </div> {{else if eq .Type 13}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}} </span> {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} @@ -297,11 +271,9 @@ {{else if eq .Type 14}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}} </span> {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} @@ -313,33 +285,27 @@ {{else if eq .Type 15}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}} </span> </div> {{else if eq .Type 16}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}} </span> </div> {{else if eq .Type 17}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$parsedDeadline := .Content | ParseDeadline}} {{$.locale.Tr "repo.issues.due_date_modified" (index $parsedDeadline 0) (index $parsedDeadline 1) $createdStr | Safe}} </span> @@ -347,22 +313,18 @@ {{else if eq .Type 18}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}} </span> </div> {{else if eq .Type 19}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-package-dependents"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}} </span> {{if .DependentIssue}} @@ -383,11 +345,9 @@ {{else if eq .Type 20}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-package-dependents"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}} </span> {{if .DependentIssue}} @@ -424,7 +384,7 @@ <span class="text grey"> {{if $.Repository.OriginalURL}}</span> <span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span> {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{end}} {{if eq .Review.Type 1}} @@ -455,7 +415,7 @@ <span class="text grey"> {{if $.Repository.OriginalURL}}</span> <span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span> {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{end}} {{$.locale.Tr "repo.issues.review.left_comment" | Safe}} @@ -583,7 +543,7 @@ <span class="text grey"> {{if $.Repository.OriginalURL}}</span> <span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span> {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{end}} {{$.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdSubStr | Safe}} </span> @@ -668,17 +628,15 @@ {{else if eq .Type 23}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-lock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} {{if .Content}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}} </span> {{else}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.lock_no_reason" $createdStr | Safe}} </span> {{end}} @@ -686,33 +644,28 @@ {{else if eq .Type 24}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-key"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.unlock_comment" $createdStr | Safe}} </span> </div> {{else if eq .Type 25}} <div class="timeline-item event"> <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + <a{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a> {{$.locale.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} </span> </div> {{else if eq .Type 26}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} + {{$.locale.Tr "repo.issues.del_time_history" $createdStr | Safe}} </span> <div class="detail"> @@ -723,11 +676,9 @@ {{else if eq .Type 27}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-eye"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if (gt .AssigneeID 0)}} {{if .RemovedAssignee}} {{if eq .PosterID .AssigneeID}} @@ -751,7 +702,7 @@ <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-repo-push"}}</span> <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if .IsForcePush}} {{$.locale.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}} {{else}} @@ -766,11 +717,9 @@ {{if not $.UnitProjectsGlobalDisabled}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-project"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if gt .OldProjectID 0}} {{if gt .ProjectID 0}} {{$.locale.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}} @@ -791,7 +740,7 @@ </a> <span class="badge grey">{{svg "octicon-x" 16}}</span> <span class="text grey"> - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{$reviewerName := ""}} {{if eq .Review.OriginalAuthor ""}} {{$reviewerName = .Review.Reviewer.Name}} @@ -825,11 +774,9 @@ {{else if eq .Type 33}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> + {{template "shared/user/avatarlink" .Poster}} <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if and .OldRef .NewRef}} {{$.locale.Tr "repo.issues.change_ref_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} {{else if .OldRef}} @@ -843,7 +790,7 @@ <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-git-merge" 16}}</span> <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{template "shared/user/authorlink" .Poster}} {{if eq .Type 34}}{{$.locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr | Safe}} {{else}}{{$.locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr | Safe}}{{end}} </span> diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl new file mode 100644 index 0000000000..81c2a4ed5e --- /dev/null +++ b/templates/shared/user/authorlink.tmpl @@ -0,0 +1,3 @@ +<a class="author"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}> + {{.GetDisplayName}} +</a> diff --git a/templates/shared/user/avatarlink.tmpl b/templates/shared/user/avatarlink.tmpl new file mode 100644 index 0000000000..40f5ee7129 --- /dev/null +++ b/templates/shared/user/avatarlink.tmpl @@ -0,0 +1,3 @@ +<a class="avatar"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}> + {{avatar .}} +</a> diff --git a/templates/shared/user/namelink.tmpl b/templates/shared/user/namelink.tmpl new file mode 100644 index 0000000000..25dff36a78 --- /dev/null +++ b/templates/shared/user/namelink.tmpl @@ -0,0 +1,3 @@ +<a{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}> + {{.GetDisplayName}} +</a> |