mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-03 00:02:14 -04:00
Compare commits
27 Commits
c63cbeb32f
...
752f3522f1
Author | SHA1 | Date | |
---|---|---|---|
|
752f3522f1 | ||
|
b907b9fb1a | ||
|
c5d74e5869 | ||
|
daf7629eb8 | ||
|
40caf99203 | ||
|
b09ada694e | ||
|
05c4db8de0 | ||
|
7d53f05c85 | ||
|
3703c2cd0b | ||
|
1f1425551b | ||
|
099ccf229d | ||
|
dd8191fb51 | ||
|
7fcf619006 | ||
|
4a0796ae1a | ||
|
b0456cfd4c | ||
|
9ce1cae99e | ||
|
71480fc4f1 | ||
|
0f1aed2261 | ||
|
c318cd08b6 | ||
|
5807ae0fc1 | ||
|
2a2400102b | ||
|
485a27ccdd | ||
|
11c3f7f900 | ||
|
5039cc98ac | ||
|
1e67f18f25 | ||
|
3df6e9397a | ||
|
eaf179570b |
6
go.mod
6
go.mod
@ -109,7 +109,7 @@ require (
|
|||||||
github.com/ulikunitz/xz v0.5.15
|
github.com/ulikunitz/xz v0.5.15
|
||||||
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
|
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
|
||||||
github.com/urfave/cli/v3 v3.4.1
|
github.com/urfave/cli/v3 v3.4.1
|
||||||
github.com/wneessen/go-mail v0.6.2
|
github.com/wneessen/go-mail v0.7.1
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0
|
github.com/xeipuuv/gojsonschema v1.2.0
|
||||||
github.com/yohcop/openid-go v1.0.1
|
github.com/yohcop/openid-go v1.0.1
|
||||||
github.com/yuin/goldmark v1.7.13
|
github.com/yuin/goldmark v1.7.13
|
||||||
@ -120,9 +120,9 @@ require (
|
|||||||
golang.org/x/image v0.30.0
|
golang.org/x/image v0.30.0
|
||||||
golang.org/x/net v0.43.0
|
golang.org/x/net v0.43.0
|
||||||
golang.org/x/oauth2 v0.30.0
|
golang.org/x/oauth2 v0.30.0
|
||||||
golang.org/x/sync v0.16.0
|
golang.org/x/sync v0.17.0
|
||||||
golang.org/x/sys v0.35.0
|
golang.org/x/sys v0.35.0
|
||||||
golang.org/x/text v0.28.0
|
golang.org/x/text v0.29.0
|
||||||
google.golang.org/grpc v1.75.0
|
google.golang.org/grpc v1.75.0
|
||||||
google.golang.org/protobuf v1.36.8
|
google.golang.org/protobuf v1.36.8
|
||||||
gopkg.in/ini.v1 v1.67.0
|
gopkg.in/ini.v1 v1.67.0
|
||||||
|
17
go.sum
17
go.sum
@ -765,8 +765,8 @@ github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZ
|
|||||||
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
||||||
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||||
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||||
github.com/wneessen/go-mail v0.6.2 h1:c6V7c8D2mz868z9WJ+8zDKtUyLfZ1++uAZmo2GRFji8=
|
github.com/wneessen/go-mail v0.7.1 h1:rvy63sp14N06/kdGqCYwW8Na5gDCXjTQM1E7So4PuKk=
|
||||||
github.com/wneessen/go-mail v0.6.2/go.mod h1:L/PYjPK3/2ZlNb2/FjEBIn9n1rUWjW+Toy531oVmeb4=
|
github.com/wneessen/go-mail v0.7.1/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k=
|
||||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||||
@ -837,7 +837,6 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
|
|||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
|
||||||
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||||
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -930,9 +929,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
|||||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -974,7 +972,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||||
@ -987,7 +984,6 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
|||||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||||
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||||
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
|
||||||
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||||
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -1003,9 +999,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
|||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
activities_model "code.gitea.io/gitea/models/activities"
|
activities_model "code.gitea.io/gitea/models/activities"
|
||||||
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
||||||
@ -388,8 +389,10 @@ func ViewIssue(ctx *context.Context) {
|
|||||||
prepareIssueViewSidebarTimeTracker,
|
prepareIssueViewSidebarTimeTracker,
|
||||||
prepareIssueViewSidebarDependency,
|
prepareIssueViewSidebarDependency,
|
||||||
prepareIssueViewSidebarPin,
|
prepareIssueViewSidebarPin,
|
||||||
func(ctx *context.Context, issue *issues_model.Issue) { preparePullViewPullInfo(ctx, issue) },
|
func(ctx *context.Context, issue *issues_model.Issue) {
|
||||||
preparePullViewReviewAndMerge,
|
compareInfo := preparePullViewPullInfo(ctx, issue)
|
||||||
|
preparePullViewReviewAndMerge(ctx, issue, compareInfo)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, prepareFunc := range prepareFuncs {
|
for _, prepareFunc := range prepareFuncs {
|
||||||
@ -441,8 +444,8 @@ func ViewPullMergeBox(ctx *context.Context) {
|
|||||||
ctx.NotFound(nil)
|
ctx.NotFound(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
preparePullViewPullInfo(ctx, issue)
|
compareInfo := preparePullViewPullInfo(ctx, issue)
|
||||||
preparePullViewReviewAndMerge(ctx, issue)
|
preparePullViewReviewAndMerge(ctx, issue, compareInfo)
|
||||||
ctx.Data["PullMergeBoxReloading"] = issue.PullRequest.IsChecking()
|
ctx.Data["PullMergeBoxReloading"] = issue.PullRequest.IsChecking()
|
||||||
|
|
||||||
// TODO: it should use a dedicated struct to render the pull merge box, to make sure all data is prepared correctly
|
// TODO: it should use a dedicated struct to render the pull merge box, to make sure all data is prepared correctly
|
||||||
@ -823,7 +826,7 @@ func prepareIssueViewCommentsAndSidebarParticipants(ctx *context.Context, issue
|
|||||||
ctx.Data["NumParticipants"] = len(participants)
|
ctx.Data["NumParticipants"] = len(participants)
|
||||||
}
|
}
|
||||||
|
|
||||||
func preparePullViewReviewAndMerge(ctx *context.Context, issue *issues_model.Issue) {
|
func preparePullViewReviewAndMerge(ctx *context.Context, issue *issues_model.Issue, compareInfo *pull_service.CompareInfo) {
|
||||||
getBranchData(ctx, issue)
|
getBranchData(ctx, issue)
|
||||||
if !issue.IsPull {
|
if !issue.IsPull {
|
||||||
return
|
return
|
||||||
@ -934,8 +937,22 @@ func preparePullViewReviewAndMerge(ctx *context.Context, issue *issues_model.Iss
|
|||||||
ctx.ServerError("GetDefaultSquashMergeMessage", err)
|
ctx.ServerError("GetDefaultSquashMergeMessage", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
_, coAuthors := pull_service.GetSquashMergeCommitMessages(ctx, pull)
|
||||||
|
|
||||||
|
defaultSquashMergeBody = fmt.Sprintf("%s%s", defaultSquashMergeBody, coAuthors)
|
||||||
|
|
||||||
|
commitsBuilder := strings.Builder{}
|
||||||
|
for _, c := range compareInfo.Commits {
|
||||||
|
commitsBuilder.WriteString("* ")
|
||||||
|
commitsBuilder.WriteString(c.CommitMessage)
|
||||||
|
commitsBuilder.WriteRune('\n')
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["DefaultSquashMergeMessage"] = defaultSquashMergeMessage
|
ctx.Data["DefaultSquashMergeMessage"] = defaultSquashMergeMessage
|
||||||
ctx.Data["DefaultSquashMergeBody"] = defaultSquashMergeBody
|
ctx.Data["DefaultSquashMergeBody"] = fmt.Sprintf("--------------------\n%s%s", commitsBuilder.String(), defaultSquashMergeBody)
|
||||||
|
if len(pull.Issue.Content) == 0 {
|
||||||
|
ctx.Data["DefaultSquashMergeBody"] = fmt.Sprintf("%s%s", commitsBuilder.String(), defaultSquashMergeBody)
|
||||||
|
}
|
||||||
|
|
||||||
pb, err := git_model.GetFirstMatchProtectedBranchRule(ctx, pull.BaseRepoID, pull.BaseBranch)
|
pb, err := git_model.GetFirstMatchProtectedBranchRule(ctx, pull.BaseRepoID, pull.BaseBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -430,7 +430,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *pull_
|
|||||||
ctx.ServerError("IsUserAllowedToUpdate", err)
|
ctx.ServerError("IsUserAllowedToUpdate", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ctx.Data["GetCommitMessages"] = pull_service.GetSquashMergeCommitMessages(ctx, pull)
|
ctx.Data["GetCommitMessages"], _ = pull_service.GetSquashMergeCommitMessages(ctx, pull)
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["GetCommitMessages"] = ""
|
ctx.Data["GetCommitMessages"] = ""
|
||||||
}
|
}
|
||||||
|
@ -758,15 +758,15 @@ func CloseRepoBranchesPulls(ctx context.Context, doer *user_model.User, repo *re
|
|||||||
var commitMessageTrailersPattern = regexp.MustCompile(`(?:^|\n\n)(?:[\w-]+[ \t]*:[^\n]+\n*(?:[ \t]+[^\n]+\n*)*)+$`)
|
var commitMessageTrailersPattern = regexp.MustCompile(`(?:^|\n\n)(?:[\w-]+[ \t]*:[^\n]+\n*(?:[ \t]+[^\n]+\n*)*)+$`)
|
||||||
|
|
||||||
// GetSquashMergeCommitMessages returns the commit messages between head and merge base (if there is one)
|
// GetSquashMergeCommitMessages returns the commit messages between head and merge base (if there is one)
|
||||||
func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequest) string {
|
func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequest) (string, string) {
|
||||||
if err := pr.LoadIssue(ctx); err != nil {
|
if err := pr.LoadIssue(ctx); err != nil {
|
||||||
log.Error("Cannot load issue %d for PR id %d: Error: %v", pr.IssueID, pr.ID, err)
|
log.Error("Cannot load issue %d for PR id %d: Error: %v", pr.IssueID, pr.ID, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pr.Issue.LoadPoster(ctx); err != nil {
|
if err := pr.Issue.LoadPoster(ctx); err != nil {
|
||||||
log.Error("Cannot load poster %d for pr id %d, index %d Error: %v", pr.Issue.PosterID, pr.ID, pr.Index, err)
|
log.Error("Cannot load poster %d for pr id %d, index %d Error: %v", pr.Issue.PosterID, pr.ID, pr.Index, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if pr.HeadRepo == nil {
|
if pr.HeadRepo == nil {
|
||||||
@ -774,14 +774,14 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
pr.HeadRepo, err = repo_model.GetRepositoryByID(ctx, pr.HeadRepoID)
|
pr.HeadRepo, err = repo_model.GetRepositoryByID(ctx, pr.HeadRepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("GetRepositoryByIdCtx[%d]: %v", pr.HeadRepoID, err)
|
log.Error("GetRepositoryByIdCtx[%d]: %v", pr.HeadRepoID, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, pr.HeadRepo)
|
gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, pr.HeadRepo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to open head repository: Error: %v", err)
|
log.Error("Unable to open head repository: Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
defer closer.Close()
|
defer closer.Close()
|
||||||
|
|
||||||
@ -792,19 +792,19 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
pr.HeadCommitID, err = gitRepo.GetRefCommitID(pr.GetGitHeadRefName())
|
pr.HeadCommitID, err = gitRepo.GetRefCommitID(pr.GetGitHeadRefName())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get head commit: %s Error: %v", pr.GetGitHeadRefName(), err)
|
log.Error("Unable to get head commit: %s Error: %v", pr.GetGitHeadRefName(), err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
headCommit, err = gitRepo.GetCommit(pr.HeadCommitID)
|
headCommit, err = gitRepo.GetCommit(pr.HeadCommitID)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get head commit: %s Error: %v", pr.HeadBranch, err)
|
log.Error("Unable to get head commit: %s Error: %v", pr.HeadBranch, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeBase, err := gitRepo.GetCommit(pr.MergeBase)
|
mergeBase, err := gitRepo.GetCommit(pr.MergeBase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get merge base commit: %s Error: %v", pr.MergeBase, err)
|
log.Error("Unable to get merge base commit: %s Error: %v", pr.MergeBase, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
limit := setting.Repository.PullRequest.DefaultMergeMessageCommitsLimit
|
limit := setting.Repository.PullRequest.DefaultMergeMessageCommitsLimit
|
||||||
@ -812,7 +812,7 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
commits, err := gitRepo.CommitsBetweenLimit(headCommit, mergeBase, limit, 0)
|
commits, err := gitRepo.CommitsBetweenLimit(headCommit, mergeBase, limit, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get commits between: %s %s Error: %v", pr.HeadBranch, pr.MergeBase, err)
|
log.Error("Unable to get commits between: %s %s Error: %v", pr.HeadBranch, pr.MergeBase, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
posterSig := pr.Issue.Poster.NewGitSig().String()
|
posterSig := pr.Issue.Poster.NewGitSig().String()
|
||||||
@ -820,6 +820,7 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
uniqueAuthors := make(container.Set[string])
|
uniqueAuthors := make(container.Set[string])
|
||||||
authors := make([]string, 0, len(commits))
|
authors := make([]string, 0, len(commits))
|
||||||
stringBuilder := strings.Builder{}
|
stringBuilder := strings.Builder{}
|
||||||
|
coAuthorStringBuilder := strings.Builder{}
|
||||||
|
|
||||||
if !setting.Repository.PullRequest.PopulateSquashCommentWithCommitMessages {
|
if !setting.Repository.PullRequest.PopulateSquashCommentWithCommitMessages {
|
||||||
message := strings.TrimSpace(pr.Issue.Content)
|
message := strings.TrimSpace(pr.Issue.Content)
|
||||||
@ -853,12 +854,12 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
}
|
}
|
||||||
if _, err := stringBuilder.Write(toWrite); err != nil {
|
if _, err := stringBuilder.Write(toWrite); err != nil {
|
||||||
log.Error("Unable to write commit message Error: %v", err)
|
log.Error("Unable to write commit message Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := stringBuilder.WriteRune('\n'); err != nil {
|
if _, err := stringBuilder.WriteRune('\n'); err != nil {
|
||||||
log.Error("Unable to write commit message Error: %v", err)
|
log.Error("Unable to write commit message Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -882,7 +883,7 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
commits, err := gitRepo.CommitsBetweenLimit(headCommit, mergeBase, limit, skip)
|
commits, err := gitRepo.CommitsBetweenLimit(headCommit, mergeBase, limit, skip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get commits between: %s %s Error: %v", pr.HeadBranch, pr.MergeBase, err)
|
log.Error("Unable to get commits between: %s %s Error: %v", pr.HeadBranch, pr.MergeBase, err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
if len(commits) == 0 {
|
if len(commits) == 0 {
|
||||||
break
|
break
|
||||||
@ -901,21 +902,21 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, author := range authors {
|
for _, author := range authors {
|
||||||
if _, err := stringBuilder.WriteString("Co-authored-by: "); err != nil {
|
if _, err := coAuthorStringBuilder.WriteString("Co-authored-by: "); err != nil {
|
||||||
log.Error("Unable to write to string builder Error: %v", err)
|
log.Error("Unable to write to string builder Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
if _, err := stringBuilder.WriteString(author); err != nil {
|
if _, err := coAuthorStringBuilder.WriteString(author); err != nil {
|
||||||
log.Error("Unable to write to string builder Error: %v", err)
|
log.Error("Unable to write to string builder Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
if _, err := stringBuilder.WriteRune('\n'); err != nil {
|
if _, err := coAuthorStringBuilder.WriteRune('\n'); err != nil {
|
||||||
log.Error("Unable to write to string builder Error: %v", err)
|
log.Error("Unable to write to string builder Error: %v", err)
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringBuilder.String()
|
return stringBuilder.String(), coAuthorStringBuilder.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssuesAllCommitStatus returns a map of issue ID to a list of all statuses for the most recent commit as well as a map of issue ID to only the commit's latest status
|
// GetIssuesAllCommitStatus returns a map of issue ID to a list of all statuses for the most recent commit as well as a map of issue ID to only the commit's latest status
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSelf bool, targetBranch, sourceBranch, title string) *httptest.ResponseRecorder {
|
func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSelf bool, targetBranch, sourceBranch, title string, contents ...string) *httptest.ResponseRecorder {
|
||||||
req := NewRequest(t, "GET", path.Join(user, repo))
|
req := NewRequest(t, "GET", path.Join(user, repo))
|
||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
@ -52,9 +52,15 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSel
|
|||||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
link, exists = htmlDoc.doc.Find("form.ui.form").Attr("action")
|
link, exists = htmlDoc.doc.Find("form.ui.form").Attr("action")
|
||||||
assert.True(t, exists, "The template has changed")
|
assert.True(t, exists, "The template has changed")
|
||||||
|
|
||||||
|
content := ""
|
||||||
|
if len(contents) > 0 {
|
||||||
|
content = contents[0]
|
||||||
|
}
|
||||||
req = NewRequestWithValues(t, "POST", link, map[string]string{
|
req = NewRequestWithValues(t, "POST", link, map[string]string{
|
||||||
"_csrf": htmlDoc.GetCSRF(),
|
"_csrf": htmlDoc.GetCSRF(),
|
||||||
"title": title,
|
"title": title,
|
||||||
|
"content": content,
|
||||||
})
|
})
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
return resp
|
return resp
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -41,19 +42,27 @@ import (
|
|||||||
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"
|
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"
|
||||||
files_service "code.gitea.io/gitea/services/repository/files"
|
files_service "code.gitea.io/gitea/services/repository/files"
|
||||||
|
|
||||||
|
"github.com/PuerkitoBio/goquery"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testPullMerge(t *testing.T, session *TestSession, user, repo, pullnum string, mergeStyle repo_model.MergeStyle, deleteBranch bool) *httptest.ResponseRecorder {
|
func testPullMerge(t *testing.T, session *TestSession, user, repo, pullnum string, mergeStyle repo_model.MergeStyle, deleteBranch bool, messages ...string) *httptest.ResponseRecorder {
|
||||||
req := NewRequest(t, "GET", path.Join(user, repo, "pulls", pullnum))
|
req := NewRequest(t, "GET", path.Join(user, repo, "pulls", pullnum))
|
||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
link := path.Join(user, repo, "pulls", pullnum, "merge")
|
link := path.Join(user, repo, "pulls", pullnum, "merge")
|
||||||
|
|
||||||
|
message := ""
|
||||||
|
if len(messages) > 0 {
|
||||||
|
message = messages[0]
|
||||||
|
}
|
||||||
|
|
||||||
options := map[string]string{
|
options := map[string]string{
|
||||||
"_csrf": htmlDoc.GetCSRF(),
|
"_csrf": htmlDoc.GetCSRF(),
|
||||||
"do": string(mergeStyle),
|
"do": string(mergeStyle),
|
||||||
|
"merge_message_field": message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if deleteBranch {
|
if deleteBranch {
|
||||||
@ -166,11 +175,116 @@ func TestPullSquash(t *testing.T) {
|
|||||||
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
|
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
|
||||||
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited!)\n")
|
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited!)\n")
|
||||||
|
|
||||||
resp := testPullCreate(t, session, "user1", "repo1", false, "master", "master", "This is a pull title")
|
resp := testPullCreate(t, session, "user1", "repo1", false, "master", "master", "This is a pull title", "This is a pull content")
|
||||||
|
prURL := test.RedirectURL(resp)
|
||||||
elem := strings.Split(test.RedirectURL(resp), "/")
|
elem := strings.Split(prURL, "/")
|
||||||
assert.Equal(t, "pulls", elem[3])
|
assert.Equal(t, "pulls", elem[3])
|
||||||
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleSquash, false)
|
|
||||||
|
resp = session.MakeRequest(t, NewRequest(t, "GET", prURL), http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
dataURL, exists := htmlDoc.doc.Find("#allow-edits-from-maintainers").Attr("data-url")
|
||||||
|
assert.True(t, exists)
|
||||||
|
req := NewRequestWithValues(t, "POST", dataURL+"/set_allow_maintainer_edit", map[string]string{
|
||||||
|
"_csrf": htmlDoc.GetCSRF(),
|
||||||
|
"allow_maintainer_edit": "true",
|
||||||
|
})
|
||||||
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
|
user2Session := loginUser(t, "user2")
|
||||||
|
resp = user2Session.MakeRequest(t, NewRequest(t, "GET", prURL+"/files"), http.StatusOK)
|
||||||
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
|
nodes := htmlDoc.doc.Find(".diff-file-box[data-new-filename=\"README.md\"] .diff-file-header-actions .tippy-target a")
|
||||||
|
if assert.Equal(t, 2, nodes.Length()) {
|
||||||
|
assert.Equal(t, "Edit File", nodes.Last().Text())
|
||||||
|
editFileLink, exists := nodes.Last().Attr("href")
|
||||||
|
if assert.True(t, exists) {
|
||||||
|
// edit the file
|
||||||
|
resp := user2Session.MakeRequest(t, NewRequest(t, "GET", editFileLink), http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
lastCommit := htmlDoc.GetInputValueByName("last_commit")
|
||||||
|
assert.NotEmpty(t, lastCommit)
|
||||||
|
req := NewRequestWithValues(t, "POST", editFileLink, map[string]string{
|
||||||
|
"_csrf": htmlDoc.GetCSRF(),
|
||||||
|
"last_commit": lastCommit,
|
||||||
|
"tree_path": "README.md",
|
||||||
|
"content": "Hello, World (Edite!!)",
|
||||||
|
"commit_summary": "user2 updated the file",
|
||||||
|
"commit_choice": "direct",
|
||||||
|
})
|
||||||
|
resp = user2Session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
assert.NotEmpty(t, test.RedirectURL(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resp = user2Session.MakeRequest(t, NewRequest(t, "GET", prURL+"/files"), http.StatusOK)
|
||||||
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
|
nodes = htmlDoc.doc.Find(".diff-file-box[data-new-filename=\"README.md\"] .diff-file-header-actions .tippy-target a")
|
||||||
|
if assert.Equal(t, 2, nodes.Length()) {
|
||||||
|
assert.Equal(t, "Edit File", nodes.Last().Text())
|
||||||
|
editFileLink, exists := nodes.Last().Attr("href")
|
||||||
|
if assert.True(t, exists) {
|
||||||
|
// edit the file
|
||||||
|
resp := user2Session.MakeRequest(t, NewRequest(t, "GET", editFileLink), http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
lastCommit := htmlDoc.GetInputValueByName("last_commit")
|
||||||
|
assert.NotEmpty(t, lastCommit)
|
||||||
|
req := NewRequestWithValues(t, "POST", editFileLink, map[string]string{
|
||||||
|
"_csrf": htmlDoc.GetCSRF(),
|
||||||
|
"last_commit": lastCommit,
|
||||||
|
"tree_path": "README.md",
|
||||||
|
"content": "Hello, World (Edite!!!)",
|
||||||
|
"commit_summary": "user2 updated the file!",
|
||||||
|
"commit_choice": "direct",
|
||||||
|
})
|
||||||
|
resp = user2Session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
assert.NotEmpty(t, test.RedirectURL(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp = session.MakeRequest(t, NewRequest(t, "GET", prURL+"/merge_box"), http.StatusOK)
|
||||||
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
|
message := ""
|
||||||
|
htmlDoc.doc.Find("script").Each(func(i int, s *goquery.Selection) {
|
||||||
|
scriptContent := s.Text()
|
||||||
|
re := regexp.MustCompile(`const\s+defaultSquashMergeMessage\s*=\s*"(.*?)"\s*;`)
|
||||||
|
matches := re.FindStringSubmatch(scriptContent)
|
||||||
|
if len(matches) > 1 {
|
||||||
|
message = matches[1]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleSquash, false, message)
|
||||||
|
|
||||||
|
req = NewRequest(t, "GET", "/user2/repo1/src/branch/master/")
|
||||||
|
resp = user2Session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
|
commitHref := htmlDoc.doc.Find(".latest-commit .commit-id-short").AttrOr("href", "")
|
||||||
|
assert.NotEmpty(t, commitHref)
|
||||||
|
|
||||||
|
req = NewRequest(t, "GET", commitHref)
|
||||||
|
resp = user2Session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
|
prTitle, exists := htmlDoc.doc.Find(".commit-summary").Attr("title")
|
||||||
|
assert.True(t, exists)
|
||||||
|
assert.Contains(t, prTitle, "This is a pull title")
|
||||||
|
|
||||||
|
commitBody := htmlDoc.doc.Find(".commit-body").Text()
|
||||||
|
assert.NotEmpty(t, commitBody)
|
||||||
|
assert.Contains(t, commitBody, "--------------------")
|
||||||
|
|
||||||
|
req = NewRequest(t, "GET", fmt.Sprintf("/user2/repo1/pulls/%s/commits/list", elem[4]))
|
||||||
|
resp = user2Session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
|
var pullCommitList struct {
|
||||||
|
Commits []pull_service.CommitInfo `json:"commits"`
|
||||||
|
LastReviewCommitSha string `json:"last_review_commit_sha"`
|
||||||
|
}
|
||||||
|
DecodeJSON(t, resp, &pullCommitList)
|
||||||
|
|
||||||
|
require.Len(t, pullCommitList.Commits, 4)
|
||||||
|
|
||||||
|
for _, commit := range pullCommitList.Commits {
|
||||||
|
assert.Contains(t, commitBody, "* "+commit.Summary)
|
||||||
|
}
|
||||||
|
|
||||||
hookTasks, err = webhook.HookTasks(t.Context(), 1, 1)
|
hookTasks, err = webhook.HookTasks(t.Context(), 1, 1)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"include": [
|
"include": [
|
||||||
"${configDir}/.*",
|
|
||||||
"${configDir}/*",
|
"${configDir}/*",
|
||||||
|
"${configDir}/.*",
|
||||||
"${configDir}/tests/e2e/**/*",
|
"${configDir}/tests/e2e/**/*",
|
||||||
"${configDir}/tests/e2e/**/.*",
|
"${configDir}/tests/e2e/**/.*",
|
||||||
"${configDir}/tools/**/*",
|
"${configDir}/tools/**/*",
|
||||||
@ -17,27 +17,31 @@
|
|||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"allowUnreachableCode": false,
|
||||||
|
"allowUnusedLabels": false,
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"erasableSyntaxOnly": true,
|
"erasableSyntaxOnly": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"exactOptionalPropertyTypes": false,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"libReplacement": false,
|
"libReplacement": false,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": false,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"verbatimModuleSyntax": true,
|
"sourceMap": true,
|
||||||
"stripInternal": true,
|
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"strictBindCallApply": true,
|
"strictBindCallApply": true,
|
||||||
"strictBuiltinIteratorReturn": true,
|
"strictBuiltinIteratorReturn": true,
|
||||||
"strictFunctionTypes": true,
|
"strictFunctionTypes": true,
|
||||||
"noImplicitAny": true,
|
"stripInternal": true,
|
||||||
"noImplicitThis": true,
|
"verbatimModuleSyntax": true,
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
|
||||||
"exactOptionalPropertyTypes": false,
|
|
||||||
"sourceMap": true,
|
|
||||||
"types": [
|
"types": [
|
||||||
"vitest/globals",
|
"vitest/globals",
|
||||||
"./web_src/js/globals.d.ts",
|
"./web_src/js/globals.d.ts",
|
||||||
|
@ -10,7 +10,7 @@ export function initTableSort() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tableSort(normSort: string, revSort: string, isDefault: string) {
|
function tableSort(normSort: string, revSort: string, isDefault: string) {
|
||||||
if (!normSort) return false;
|
if (!normSort) return;
|
||||||
if (!revSort) revSort = '';
|
if (!revSort) revSort = '';
|
||||||
|
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
|
@ -43,7 +43,7 @@ type ToastOpts = {
|
|||||||
type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast};
|
type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast};
|
||||||
|
|
||||||
/** See https://github.com/apvarun/toastify-js#api for options */
|
/** See https://github.com/apvarun/toastify-js#api for options */
|
||||||
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
|
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast | null {
|
||||||
const body = useHtmlBody ? message : htmlEscape(message);
|
const body = useHtmlBody ? message : htmlEscape(message);
|
||||||
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;
|
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;
|
||||||
const duplicateKey = preventDuplicates ? (preventDuplicates === true ? `${level}-${body}` : preventDuplicates) : '';
|
const duplicateKey = preventDuplicates ? (preventDuplicates === true ? `${level}-${body}` : preventDuplicates) : '';
|
||||||
@ -56,7 +56,7 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
|
|||||||
showElem(toastDupNumEl);
|
showElem(toastDupNumEl);
|
||||||
toastDupNumEl.textContent = String(Number(toastDupNumEl.textContent) + 1);
|
toastDupNumEl.textContent = String(Number(toastDupNumEl.textContent) + 1);
|
||||||
animateOnce(toastDupNumEl, 'pulse-1p5-200');
|
animateOnce(toastDupNumEl, 'pulse-1p5-200');
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,15 +83,15 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
|
|||||||
return toast;
|
return toast;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showInfoToast(message: string, opts?: ToastOpts): Toast {
|
export function showInfoToast(message: string, opts?: ToastOpts): Toast | null {
|
||||||
return showToast(message, 'info', opts);
|
return showToast(message, 'info', opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showWarningToast(message: string, opts?: ToastOpts): Toast {
|
export function showWarningToast(message: string, opts?: ToastOpts): Toast | null {
|
||||||
return showToast(message, 'warning', opts);
|
return showToast(message, 'warning', opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showErrorToast(message: string, opts?: ToastOpts): Toast {
|
export function showErrorToast(message: string, opts?: ToastOpts): Toast | null {
|
||||||
return showToast(message, 'error', opts);
|
return showToast(message, 'error', opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user