Make "Ghost" not link to 404 page (#6410)

* Make Ghost not link to 404 page

* Make correct localization label show

* Create and use GetLastEventLabelFake for when a Ghost user has made the action, thus not linking to a user profile
* Add corresponding _fake entries to locale_en-US

* Make Ghost avatar not link to 404 page

* Make Ghost on milestone_issues not link to 404 page
This commit is contained in:
oscar.lofwenhamn 2019-03-27 23:22:39 +01:00 committed by techknowlogick
parent ee0d3eeadc
commit 2019983e77
7 changed files with 35 additions and 5 deletions

View File

@ -990,6 +990,17 @@ func (issue *Issue) GetLastEventLabel() string {
return "repo.issues.opened_by" return "repo.issues.opened_by"
} }
// GetLastEventLabelFake returns the localization label for the current issue without providing a link in the username.
func (issue *Issue) GetLastEventLabelFake() string {
if issue.IsClosed {
if issue.IsPull && issue.PullRequest.HasMerged {
return "repo.pulls.merged_by_fake"
}
return "repo.issues.closed_by_fake"
}
return "repo.issues.opened_by_fake"
}
// NewIssueOptions represents the options of a new issue. // NewIssueOptions represents the options of a new issue.
type NewIssueOptions struct { type NewIssueOptions struct {
Repo *Repository Repo *Repository

View File

@ -770,8 +770,10 @@ issues.action_assignee = Assignee
issues.action_assignee_no_select = No assignee issues.action_assignee_no_select = No assignee
issues.opened_by = opened %[1]s by <a href="%[2]s">%[3]s</a> issues.opened_by = opened %[1]s by <a href="%[2]s">%[3]s</a>
pulls.merged_by = merged %[1]s by <a href="%[2]s">%[3]s</a> pulls.merged_by = merged %[1]s by <a href="%[2]s">%[3]s</a>
pulls.merged_by_fake = merged %[1]s by %[2]s
issues.closed_by = closed %[1]s by <a href="%[2]s">%[3]s</a> issues.closed_by = closed %[1]s by <a href="%[2]s">%[3]s</a>
issues.opened_by_fake = opened %[1]s by %[2]s issues.opened_by_fake = opened %[1]s by %[2]s
issues.closed_by_fake = closed %[1]s by %[2]s
issues.previous = Previous issues.previous = Previous
issues.next = Next issues.next = Next
issues.open_title = Open issues.open_title = Open

View File

@ -220,7 +220,12 @@
<p class="desc"> <p class="desc">
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{if gt .Poster.ID 0}}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{else}}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.Name | Safe}}
{{end}}
{{$tasks := .GetTasks}} {{$tasks := .GetTasks}}
{{if gt $tasks 0}} {{if gt $tasks 0}}

View File

@ -203,7 +203,11 @@
{{end}} {{end}}
<p class="desc"> <p class="desc">
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}} {{if gt .Poster.ID 0}}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{else}}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.Name | Safe}}
{{end}}
{{$tasks := .GetTasks}} {{$tasks := .GetTasks}}
{{if gt $tasks 0}} {{if gt $tasks 0}}
{{$tasksDone := .GetTasksDone}} {{$tasksDone := .GetTasksDone}}

View File

@ -112,7 +112,7 @@
<span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span> <span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
<div> <div>
{{range .Participants}} {{range .Participants}}
<a href="{{.HomeLink}}"> <a {{if gt .ID 0}}href="{{.HomeLink}}"{{end}}>
<img class="ui avatar image poping up" src="{{.RelAvatarLink}}" data-content="{{.DisplayName}}" data-position="top center" data-variation="small inverted"> <img class="ui avatar image poping up" src="{{.RelAvatarLink}}" data-content="{{.DisplayName}}" data-position="top center" data-variation="small inverted">
</a> </a>
{{end}} {{end}}

View File

@ -7,7 +7,11 @@
<div class="ui fourteen wide column"> <div class="ui fourteen wide column">
<div class="{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}push news{{end}}"> <div class="{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}push news{{end}}">
<p> <p>
<a href="{{AppSubUrl}}/{{.GetActUserName}}" title="{{.GetActFullName}}">{{.ShortActUserName}}</a> {{if gt .ActUser.ID 0}}
<a href="{{AppSubUrl}}/{{.GetActUserName}}" title="{{.GetActFullName}}">{{.ShortActUserName}}</a>
{{else}}
{{.ShortActUserName}}
{{end}}
{{if eq .GetOpType 1}} {{if eq .GetOpType 1}}
{{$.i18n.Tr "action.create_repo" .GetRepoLink .ShortRepoPath | Str2html}} {{$.i18n.Tr "action.create_repo" .GetRepoLink .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 2}} {{else if eq .GetOpType 2}}

View File

@ -86,7 +86,11 @@
{{end}} {{end}}
<p class="desc"> <p class="desc">
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}} {{if gt .Poster.ID 0}}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{else}}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.Name | Safe}}
{{end}}
{{if .Assignee}} {{if .Assignee}}
<a class="ui right assignee poping up" href="{{.Assignee.HomeLink}}" data-content="{{.Assignee.Name}}" data-variation="inverted" data-position="left center"> <a class="ui right assignee poping up" href="{{.Assignee.HomeLink}}" data-content="{{.Assignee.Name}}" data-variation="inverted" data-position="left center">
<img class="ui avatar image" src="{{.Assignee.RelAvatarLink}}"> <img class="ui avatar image" src="{{.Assignee.RelAvatarLink}}">