File tree 3 files changed +23
-4
lines changed
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -567,6 +567,15 @@ func PrepareCompareDiff(
567
567
} else {
568
568
title = headBranch
569
569
}
570
+ if len (title ) > 255 {
571
+ if ctx .Data ["content" ] != nil {
572
+ ctx .Data ["content" ] = fmt .Sprintf ("...%s\n \n %s" , title [252 :], ctx .Data ["content" ])
573
+ } else {
574
+ ctx .Data ["content" ] = "..." + title [252 :] + "\n "
575
+ }
576
+ title = title [:252 ] + "..."
577
+ }
578
+
570
579
ctx .Data ["title" ] = title
571
580
ctx .Data ["Username" ] = headUser .Name
572
581
ctx .Data ["Reponame" ] = headRepo .Name
Original file line number Diff line number Diff line change @@ -1001,10 +1001,14 @@ func CompareAndPullRequestPost(ctx *context.Context) {
1001
1001
ctx .Data ["Title" ] = ctx .Tr ("repo.pulls.compare_changes" )
1002
1002
ctx .Data ["PageIsComparePull" ] = true
1003
1003
ctx .Data ["IsDiffCompare" ] = true
1004
+ ctx .Data ["IsRepoToolbarCommits" ] = true
1005
+ ctx .Data ["RequireTribute" ] = true
1006
+ ctx .Data ["RequireSimpleMDE" ] = true
1004
1007
ctx .Data ["RequireHighlightJS" ] = true
1005
1008
ctx .Data ["PullRequestWorkInProgressPrefixes" ] = setting .Repository .PullRequest .WorkInProgressPrefixes
1006
1009
ctx .Data ["IsAttachmentEnabled" ] = setting .Attachment .Enabled
1007
1010
upload .AddUploadContext (ctx , "comment" )
1011
+ ctx .Data ["HasIssuesOrPullsWritePermission" ] = ctx .Repo .CanWrite (models .UnitTypePullRequests )
1008
1012
1009
1013
var (
1010
1014
repo = ctx .Repo .Repository
@@ -1037,6 +1041,12 @@ func CompareAndPullRequestPost(ctx *context.Context) {
1037
1041
return
1038
1042
}
1039
1043
1044
+ if len (form .Title ) > 255 {
1045
+ form .Content = "..." + form .Title [252 :] + "\n \n " + form .Content
1046
+ form .Title = form .Title [:252 ] + "..."
1047
+ }
1048
+ middleware .AssignForm (form , ctx .Data )
1049
+
1040
1050
ctx .HTML (http .StatusOK , tplCompareDiff )
1041
1051
return
1042
1052
}
Original file line number Diff line number Diff line change 176
176
{{if .IsNothingToCompare}}
177
177
{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) }}
178
178
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div>
179
- <div class="ui info message show-form-container">
179
+ <div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}} >
180
180
<button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button>
181
181
</div>
182
- <div class="pullrequest-form" style="display: none">
182
+ <div class="pullrequest-form" {{if not .Flash}} style="display: none"{{end}} >
183
183
{{template "repo/issue/new_form" .}}
184
184
</div>
185
185
{{else}}
192
192
</div>
193
193
{{else}}
194
194
{{if and $.IsSigned (not .Repository.IsArchived)}}
195
- <div class="ui info message show-form-container">
195
+ <div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}} >
196
196
<button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button>
197
197
</div>
198
198
{{else if .Repository.IsArchived}}
201
201
</div>
202
202
{{end}}
203
203
{{if $.IsSigned}}
204
- <div class="pullrequest-form" style="display: none">
204
+ <div class="pullrequest-form" {{if not .Flash}} style="display: none"{{end}} >
205
205
{{template "repo/issue/new_form" .}}
206
206
</div>
207
207
{{end}}
You can’t perform that action at this time.
0 commit comments