Skip to content

Commit 3edd91e

Browse files
author
Oscar Löfwenhamn
committed
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
1 parent f8e5ee7 commit 3edd91e

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

models/issue.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,17 @@ func (issue *Issue) GetLastEventLabel() string {
990990
return "repo.issues.opened_by"
991991
}
992992

993+
// GetLastEventLabelFake returns the localization label for the current issue without providing a link in the username.
994+
func (issue *Issue) GetLastEventLabelFake() string {
995+
if issue.IsClosed {
996+
if issue.IsPull && issue.PullRequest.HasMerged {
997+
return "repo.pulls.merged_by_fake"
998+
}
999+
return "repo.issues.closed_by_fake"
1000+
}
1001+
return "repo.issues.opened_by_fake"
1002+
}
1003+
9931004
// NewIssueOptions represents the options of a new issue.
9941005
type NewIssueOptions struct {
9951006
Repo *Repository

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,10 @@ issues.action_assignee = Assignee
770770
issues.action_assignee_no_select = No assignee
771771
issues.opened_by = opened %[1]s by <a href="%[2]s">%[3]s</a>
772772
pulls.merged_by = merged %[1]s by <a href="%[2]s">%[3]s</a>
773+
pulls.merged_by_fake = merged %[1]s by %[2]s
773774
issues.closed_by = closed %[1]s by <a href="%[2]s">%[3]s</a>
774775
issues.opened_by_fake = opened %[1]s by %[2]s
776+
issues.closed_by_fake = closed %[1]s by %[2]s
775777
issues.previous = Previous
776778
issues.next = Next
777779
issues.open_title = Open

templates/repo/issue/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@
222222
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
223223

224224
{{if gt .Poster.ID 0}}
225-
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}}
225+
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
226226
{{else}}
227-
{{$.i18n.Tr "repo.issues.opened_by_fake" $timeStr .Poster.Name | Safe}}
227+
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.Name | Safe}}
228228
{{end}}
229229

230230
{{$tasks := .GetTasks}}

templates/user/dashboard/issues.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@
8787

8888
<p class="desc">
8989
{{if gt .Poster.ID 0}}
90-
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}}
90+
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.Name | Safe}}
9191
{{else}}
92-
{{$.i18n.Tr "repo.issues.opened_by_fake" $timeStr .Poster.Name | Safe}}
92+
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.Name | Safe}}
9393
{{end}}
9494
{{if .Assignee}}
9595
<a class="ui right assignee poping up" href="{{.Assignee.HomeLink}}" data-content="{{.Assignee.Name}}" data-variation="inverted" data-position="left center">

0 commit comments

Comments
 (0)