diff options
author | mrsdizzie <info@mrsdizzie.com> | 2019-07-07 22:14:12 -0400 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-07-08 10:14:12 +0800 |
commit | 1f1ecda541d7f526c004e7bfabab814dbc84dc2c (patch) | |
tree | b53d4e692de9b4a5cc0ebfebf09a4cb5d8d5880f /templates/repo/issue | |
parent | fcda2d5b35ec9bec9a8e8fa0a0fb04cb21593648 (diff) | |
download | gitea-1f1ecda541d7f526c004e7bfabab814dbc84dc2c.tar.gz gitea-1f1ecda541d7f526c004e7bfabab814dbc84dc2c.zip |
Display original author and URL information when showing migrated issues/comments (#7352)
* Store original author info for migrated issues and comments
Keep original author name for displaying in Gitea interface and also
store original author user ID for potential future use in linking
accounts from old location.
* Add original_url for repo
Store the original URL for a migrated repo
Clean up migrations/tests
* fix migration
* fix golangci-lint
* make 'make revive' happy also
* Modify templates to use OriginalAuthor if set
Use the original author name in templates if it is set rather than the
user who migrated/currently owns the issues
* formatting fixes
* make generate-swagger
* Use default avatar for imported comments
* Remove no longer used IgnoreIssueAuthor option
* Add OriginalAuthorID to swagger also
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/list.tmpl | 5 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 22 |
4 files changed, 36 insertions, 7 deletions
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 3007c99106..45b2cc67e3 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -234,8 +234,9 @@ <p class="desc"> {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} - - {{if gt .Poster.ID 0}} + {{if .OriginalAuthor }} + {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} + {{else if gt .Poster.ID 0}} {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} {{else}} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 16700a8dc1..b3f88c662d 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -12,12 +12,20 @@ <div class="twelve wide column comment-list prevent-before-timeline"> <ui class="ui comments timeline-line"> <div class="comment"> + {{if .Issue.OriginalAuthor }} + <span class="avatar"><img src="/img/avatar_default.png"></span> + {{else}} <a class="avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}> <img src="{{.Issue.Poster.RelAvatarLink}}"> </a> + {{end}} <div class="content"> <div class="ui top attached header"> + {{if .Issue.OriginalAuthor }} + <span class="text black"><i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .Issue.OriginalAuthor }}</span><span class="text grey"> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}<span> <span class="text migrate">{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}</span> + {{else}} <span class="text grey"><a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}</span> + {{end}} {{if not $.Repository.IsArchived}} <div class="ui right actions"> {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) }} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 20474f6302..68303cf1ca 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -9,12 +9,20 @@ 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED --> {{if eq .Type 0}} <div class="comment" id="{{.HashTag}}"> + {{if .OriginalAuthor }} + <span class="avatar"><img src="/img/avatar_default.png"></span> + {{else}} <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> <img src="{{.Poster.RelAvatarLink}}"> </a> + {{end}} <div class="content"> <div class="ui top attached header"> + {{if .OriginalAuthor }} + <span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span> + {{else}} <span class="text grey"><a {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span> + {{end}} {{if not $.Repository.IsArchived}} <div class="ui right actions"> {{if gt .ShowTag 0}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 78c892fa4d..4b254d2c4b 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -27,16 +27,28 @@ {{if .Issue.IsPull}} {{if .Issue.PullRequest.HasMerged}} {{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.Lang }} - <a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.GetDisplayName}}</a> - <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits .HeadTarget .BaseTarget $mergedStr | Str2html}}</span> + {{if .Issue.OriginalAuthor }} + {{.Issue.OriginalAuthor}} + <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits .HeadTarget .BaseTarget $mergedStr | Str2html}}</span> + {{else}} + <a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.GetDisplayName}}</a> + <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits .HeadTarget .BaseTarget $mergedStr | Str2html}}</span> + {{end}} {{else}} - <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> - <span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span> + {{if .Issue.OriginalAuthor }} + {{.Issue.OriginalAuthor}} + <span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span> + {{else}} + <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> + <span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span> + {{end}} {{end}} {{else}} {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.Lang }} <span class="time-desc"> - {{if gt .Issue.Poster.ID 0}} + {{if .Issue.OriginalAuthor }} + {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr .Issue.OriginalAuthor | Safe}} + {{else if gt .Issue.Poster.ID 0}} {{$.i18n.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.HomeLink (.Issue.Poster.GetDisplayName|Escape) | Safe}} {{else}} {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr (.Issue.Poster.GetDisplayName|Escape) | Safe}} |