aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorSebastian Brückner <code@nik.dev>2024-02-24 07:49:16 +0000
committerGitHub <noreply@github.com>2024-02-24 07:49:16 +0000
commit6e5966597c2d498d1a8540dad965461d44ff8e57 (patch)
tree46650a560e88b42edd54ed0c8d5478cc8b4bdce3 /templates
parentb79c30435f439af8243ee281310258cdf141e27b (diff)
downloadgitea-6e5966597c2d498d1a8540dad965461d44ff8e57.tar.gz
gitea-6e5966597c2d498d1a8540dad965461d44ff8e57.zip
Properly migrate target branch change GitLab comment (#29340)
GitLab generates "system notes" whenever an event happens within the platform. Unlike Gitea, those events are stored and retrieved as text comments with no semantic details. The only way to tell whether a comment was generated in this manner is the `system` flag on the note type. This PR adds detection for a new specific kind of event: Changing the target branch of a PR. When detected, it is downloaded using Gitea's type for this event, and eventually uploaded into Gitea in the expected format, i.e. with no text content in the comment. This PR also updates the template used to render comments to add support for migrated comments of this type. ref: https://gitlab.com/gitlab-org/gitlab/-/blob/11bd6dc826e0bea2832324a1d7356949a9398884/app/services/system_notes/merge_requests_service.rb#L102
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/issue/view_content/comments.tmpl19
1 files changed, 15 insertions, 4 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 597f025470..7bd7e8c35d 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -365,8 +365,7 @@
{{else if eq .Type 22}}
<div class="timeline-item-group" id="{{.HashTag}}">
<div class="timeline-item event">
- {{if .OriginalAuthor}}
- {{else}}
+ {{if not .OriginalAuthor}}
{{/* Some timeline avatars need a offset to correctly align with their speech
bubble. The condition depends on review type and for positive reviews whether
there is a comment element or not */}}
@@ -495,9 +494,21 @@
{{else if eq .Type 25}}
<div class="timeline-item event">
<span class="badge">{{svg "octicon-git-branch"}}</span>
- {{template "shared/user/avatarlink" dict "user" .Poster}}
+ {{if not .OriginalAuthor}}
+ {{template "shared/user/avatarlink" dict "user" .Poster}}
+ {{end}}
<span class="text grey muted-links">
- <a{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a>
+ {{if .OriginalAuthor}}
+ <span class="text black">
+ {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
+ {{.OriginalAuthor}}
+ </span>
+ {{if $.Repository.OriginalURL}}
+ <span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}})</span>
+ {{end}}
+ {{else}}
+ {{template "shared/user/authorlink" .Poster}}
+ {{end}}
{{ctx.Locale.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr}}
</span>
</div>