Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "Ghost" not link to 404 page #6410

Merged
merged 9 commits into from
Mar 27, 2019
11 changes: 11 additions & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,17 @@ func (issue *Issue) GetLastEventLabel() string {
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.
type NewIssueOptions struct {
Repo *Repository
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,10 @@ issues.action_assignee = Assignee
issues.action_assignee_no_select = No assignee
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_fake = merged %[1]s by %[2]s
issues.closed_by = closed %[1]s by <a href="%[2]s">%[3]s</a>
issues.opened_by_fake = opened %[1]s by %[2]s
oscarlofwenhamn marked this conversation as resolved.
Show resolved Hide resolved
issues.closed_by_fake = closed %[1]s by %[2]s
issues.previous = Previous
issues.next = Next
issues.open_title = Open
Expand Down
7 changes: 6 additions & 1 deletion templates/repo/issue/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@

<p class="desc">
{{ $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}}
{{if gt $tasks 0}}
Expand Down
6 changes: 5 additions & 1 deletion templates/repo/issue/milestone_issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@
{{end}}

<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}}
{{if gt $tasks 0}}
{{$tasksDone := .GetTasksDone}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
<div>
{{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">
</a>
{{end}}
Expand Down
6 changes: 5 additions & 1 deletion templates/user/dashboard/feeds.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
<div class="ui fourteen wide column">
<div class="{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}push news{{end}}">
<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}}
{{$.i18n.Tr "action.create_repo" .GetRepoLink .ShortRepoPath | Str2html}}
{{else if eq .GetOpType 2}}
Expand Down
6 changes: 5 additions & 1 deletion templates/user/dashboard/issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@
{{end}}

<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}}
<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}}">
Expand Down