Skip to content

Commit 10a21f5

Browse files
authored
Merge branch 'main' into fix-legacy-hide
2 parents 50d07da + 3f318a4 commit 10a21f5

File tree

6 files changed

+38
-22
lines changed

6 files changed

+38
-22
lines changed

models/issues/comment.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,3 +1244,8 @@ func FixCommentTypeLabelWithOutsideLabels(ctx context.Context) (int64, error) {
12441244

12451245
return res.RowsAffected()
12461246
}
1247+
1248+
// HasOriginalAuthor returns if a comment was migrated and has an original author.
1249+
func (c *Comment) HasOriginalAuthor() bool {
1250+
return c.OriginalAuthor != "" && c.OriginalAuthorID != 0
1251+
}

models/issues/issue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,3 +2403,8 @@ func DeleteOrphanedIssues(ctx context.Context) error {
24032403
}
24042404
return nil
24052405
}
2406+
2407+
// HasOriginalAuthor returns if an issue was migrated and has an original author.
2408+
func (issue *Issue) HasOriginalAuthor() bool {
2409+
return issue.OriginalAuthor != "" && issue.OriginalAuthorID != 0
2410+
}

routers/web/repo/issue.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,11 @@ func NewIssuePost(ctx *context.Context) {
11421142
}
11431143

11441144
// roleDescriptor returns the Role Descriptor for a comment in/with the given repo, poster and issue
1145-
func roleDescriptor(ctx stdCtx.Context, repo *repo_model.Repository, poster *user_model.User, issue *issues_model.Issue) (issues_model.RoleDescriptor, error) {
1145+
func roleDescriptor(ctx stdCtx.Context, repo *repo_model.Repository, poster *user_model.User, issue *issues_model.Issue, hasOriginalAuthor bool) (issues_model.RoleDescriptor, error) {
1146+
if hasOriginalAuthor {
1147+
return issues_model.RoleDescriptorNone, nil
1148+
}
1149+
11461150
perm, err := access_model.GetUserRepoPermission(ctx, repo, poster)
11471151
if err != nil {
11481152
return issues_model.RoleDescriptorNone, err
@@ -1444,7 +1448,7 @@ func ViewIssue(ctx *context.Context) {
14441448
// check if dependencies can be created across repositories
14451449
ctx.Data["AllowCrossRepositoryDependencies"] = setting.Service.AllowCrossRepositoryDependencies
14461450

1447-
if issue.ShowRole, err = roleDescriptor(ctx, repo, issue.Poster, issue); err != nil {
1451+
if issue.ShowRole, err = roleDescriptor(ctx, repo, issue.Poster, issue, issue.HasOriginalAuthor()); err != nil {
14481452
ctx.ServerError("roleDescriptor", err)
14491453
return
14501454
}
@@ -1483,7 +1487,7 @@ func ViewIssue(ctx *context.Context) {
14831487
continue
14841488
}
14851489

1486-
comment.ShowRole, err = roleDescriptor(ctx, repo, comment.Poster, issue)
1490+
comment.ShowRole, err = roleDescriptor(ctx, repo, comment.Poster, issue, comment.HasOriginalAuthor())
14871491
if err != nil {
14881492
ctx.ServerError("roleDescriptor", err)
14891493
return
@@ -1582,7 +1586,7 @@ func ViewIssue(ctx *context.Context) {
15821586
continue
15831587
}
15841588

1585-
c.ShowRole, err = roleDescriptor(ctx, repo, c.Poster, issue)
1589+
c.ShowRole, err = roleDescriptor(ctx, repo, c.Poster, issue, c.HasOriginalAuthor())
15861590
if err != nil {
15871591
ctx.ServerError("roleDescriptor", err)
15881592
return

templates/repo/issue/view_content/pull.tmpl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@
167167
<div class="item text">
168168
{{svg "octicon-x"}}
169169
{{$.locale.Tr "repo.pulls.files_conflicted"}}
170-
{{range .ConflictedFiles}}
171-
<div>{{.}}</div>
172-
{{end}}
170+
<ul>
171+
{{range .ConflictedFiles}}
172+
<li>{{.}}</li>
173+
{{end}}
174+
</ul>
173175
</div>
174176
{{else if .IsPullRequestBroken}}
175177
<div class="item">
@@ -226,11 +228,11 @@
226228
<div class="item">
227229
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
228230
{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
229-
<div class="ui ordered list">
231+
<ul>
230232
{{range .ChangedProtectedFiles}}
231-
<div data-value="-" class="item">{{.}}</div>
233+
<li>{{.}}</li>
232234
{{end}}
233-
</div>
235+
</ul>
234236
</div>
235237
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}
236238
<div class="item">
@@ -378,10 +380,6 @@
378380
</script>
379381

380382
<div id="pull-request-merge-form"></div>
381-
382-
{{if .ShowMergeInstructions}}
383-
{{template "repo/issue/view_content/pull_merge_instruction" (dict "locale" .locale "Issue" .Issue)}}
384-
{{end}}
385383
{{else}}
386384
{{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}}
387385
<div class="ui divider"></div>
@@ -428,11 +426,11 @@
428426
<div class="item text red">
429427
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
430428
{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
431-
<div class="ui ordered list">
429+
<ul>
432430
{{range .ChangedProtectedFiles}}
433-
<div data-value="-" class="item">{{.}}</div>
431+
<li>{{.}}</li>
434432
{{end}}
435-
</div>
433+
</ul>
436434
</div>
437435
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
438436
<div class="item text red">
@@ -479,6 +477,10 @@
479477
</button>
480478
</div>
481479
{{end}}
480+
481+
{{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}}
482+
{{template "repo/issue/view_content/pull_merge_instruction" (dict "locale" .locale "Issue" .Issue)}}
483+
{{end}}
482484
</div>
483485
</div>
484486
</div>

templates/repo/issue/view_content/pull_merge_instruction.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<div class="instruct-toggle gt-mt-3"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div>
2-
<div class="instruct-content" style="display:none">
3-
<div class="ui divider"></div>
1+
<div class="ui divider"></div>
2+
<div class="instruct-toggle"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div>
3+
<div class="instruct-content gt-mt-3" style="display:none">
44
<div><h3 class="gt-di">{{$.locale.Tr "step1"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div>
55
<div class="ui secondary segment">
66
{{if eq $.Issue.PullRequest.Flow 0}}

templates/repo/shabox_badge.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}">
44
{{if ne .verification.SigningUser.ID 0}}
55
{{svg "gitea-lock"}}
6-
{{avatar $.Context .verification.SigningUser 28 "signature"}}
6+
{{avatar $.root.Context .verification.SigningUser 28 "signature"}}
77
{{else}}
88
<span title="{{$.root.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
9-
{{avatarByEmail $.Context .verification.SigningEmail "" 28 "signature"}}
9+
{{avatarByEmail $.root.Context .verification.SigningEmail "" 28 "signature"}}
1010
{{end}}
1111
</div>
1212
{{else}}

0 commit comments

Comments
 (0)