mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-22 14:27:55 +00:00
Fix remaining issues after gopls modernize
formatting (#34771)
Followup https://github.com/go-gitea/gitea/pull/34751, fix all remaining marked issues. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
a2ae7c69da
commit
46a1d52235
@ -565,18 +565,12 @@ func matchPullRequestReviewEvent(prPayload *api.PullRequestPayload, evt *jobpars
|
|||||||
actions = append(actions, "submitted", "edited")
|
actions = append(actions, "submitted", "edited")
|
||||||
}
|
}
|
||||||
|
|
||||||
matched := false
|
|
||||||
for _, val := range vals {
|
for _, val := range vals {
|
||||||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
||||||
matched = true
|
matchTimes++
|
||||||
}
|
|
||||||
if matched {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if matched {
|
|
||||||
matchTimes++
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
log.Warn("pull request review event unsupported condition %q", cond)
|
log.Warn("pull request review event unsupported condition %q", cond)
|
||||||
}
|
}
|
||||||
@ -611,18 +605,12 @@ func matchPullRequestReviewCommentEvent(prPayload *api.PullRequestPayload, evt *
|
|||||||
actions = append(actions, "created", "edited")
|
actions = append(actions, "created", "edited")
|
||||||
}
|
}
|
||||||
|
|
||||||
matched := false
|
|
||||||
for _, val := range vals {
|
for _, val := range vals {
|
||||||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
||||||
matched = true
|
matchTimes++
|
||||||
}
|
|
||||||
if matched {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if matched {
|
|
||||||
matchTimes++
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
log.Warn("pull request review comment event unsupported condition %q", cond)
|
log.Warn("pull request review comment event unsupported condition %q", cond)
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ func loadMarkupFrom(rootCfg ConfigProvider) {
|
|||||||
func newMarkupSanitizer(name string, sec ConfigSection) {
|
func newMarkupSanitizer(name string, sec ConfigSection) {
|
||||||
rule, ok := createMarkupSanitizerRule(name, sec)
|
rule, ok := createMarkupSanitizerRule(name, sec)
|
||||||
if ok {
|
if ok {
|
||||||
if after, ok0 := strings.CutPrefix(name, "sanitizer."); ok0 {
|
if after, found := strings.CutPrefix(name, "sanitizer."); found {
|
||||||
names := strings.SplitN(after, ".", 2)
|
names := strings.SplitN(after, ".", 2)
|
||||||
name = names[0]
|
name = names[0]
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,7 @@ func Install(ctx *context.Context) {
|
|||||||
form.SSLMode = setting.Database.SSLMode
|
form.SSLMode = setting.Database.SSLMode
|
||||||
|
|
||||||
curDBType := setting.Database.Type.String()
|
curDBType := setting.Database.Type.String()
|
||||||
var isCurDBTypeSupported bool
|
if !slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
|
||||||
if slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
|
|
||||||
isCurDBTypeSupported = true
|
|
||||||
}
|
|
||||||
if !isCurDBTypeSupported {
|
|
||||||
curDBType = "mysql"
|
curDBType = "mysql"
|
||||||
}
|
}
|
||||||
ctx.Data["CurDbType"] = curDBType
|
ctx.Data["CurDbType"] = curDBType
|
||||||
|
@ -94,11 +94,7 @@ func Code(ctx *context.Context) {
|
|||||||
|
|
||||||
loadRepoIDs := make([]int64, 0, len(searchResults))
|
loadRepoIDs := make([]int64, 0, len(searchResults))
|
||||||
for _, result := range searchResults {
|
for _, result := range searchResults {
|
||||||
var find bool
|
if !slices.Contains(loadRepoIDs, result.RepoID) {
|
||||||
if slices.Contains(loadRepoIDs, result.RepoID) {
|
|
||||||
find = true
|
|
||||||
}
|
|
||||||
if !find {
|
|
||||||
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,11 +87,7 @@ func CodeSearch(ctx *context.Context) {
|
|||||||
|
|
||||||
loadRepoIDs := make([]int64, 0, len(searchResults))
|
loadRepoIDs := make([]int64, 0, len(searchResults))
|
||||||
for _, result := range searchResults {
|
for _, result := range searchResults {
|
||||||
var find bool
|
if !slices.Contains(loadRepoIDs, result.RepoID) {
|
||||||
if slices.Contains(loadRepoIDs, result.RepoID) {
|
|
||||||
find = true
|
|
||||||
}
|
|
||||||
if !find {
|
|
||||||
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,9 +267,7 @@ func TestAPISearchIssues(t *testing.T) {
|
|||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
// as this API was used in the frontend, it uses UI page size
|
// as this API was used in the frontend, it uses UI page size
|
||||||
expectedIssueCount := min(
|
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||||
// from the fixtures
|
|
||||||
20, setting.UI.IssuePagingNum)
|
|
||||||
|
|
||||||
link, _ := url.Parse("/api/v1/repos/issues/search")
|
link, _ := url.Parse("/api/v1/repos/issues/search")
|
||||||
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
||||||
@ -370,9 +368,7 @@ func TestAPISearchIssuesWithLabels(t *testing.T) {
|
|||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
// as this API was used in the frontend, it uses UI page size
|
// as this API was used in the frontend, it uses UI page size
|
||||||
expectedIssueCount := min(
|
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||||
// from the fixtures
|
|
||||||
20, setting.UI.IssuePagingNum)
|
|
||||||
|
|
||||||
link, _ := url.Parse("/api/v1/repos/issues/search")
|
link, _ := url.Parse("/api/v1/repos/issues/search")
|
||||||
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
||||||
|
@ -488,9 +488,7 @@ func TestSearchIssues(t *testing.T) {
|
|||||||
|
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
expectedIssueCount := min(
|
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||||
// from the fixtures
|
|
||||||
20, setting.UI.IssuePagingNum)
|
|
||||||
|
|
||||||
link, _ := url.Parse("/issues/search")
|
link, _ := url.Parse("/issues/search")
|
||||||
req := NewRequest(t, "GET", link.String())
|
req := NewRequest(t, "GET", link.String())
|
||||||
@ -581,9 +579,7 @@ func TestSearchIssues(t *testing.T) {
|
|||||||
func TestSearchIssuesWithLabels(t *testing.T) {
|
func TestSearchIssuesWithLabels(t *testing.T) {
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
expectedIssueCount := min(
|
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||||
// from the fixtures
|
|
||||||
20, setting.UI.IssuePagingNum)
|
|
||||||
|
|
||||||
session := loginUser(t, "user1")
|
session := loginUser(t, "user1")
|
||||||
link, _ := url.Parse("/issues/search")
|
link, _ := url.Parse("/issues/search")
|
||||||
|
Loading…
Reference in New Issue
Block a user