Skip to content

Commit 00e5547

Browse files
committed
fix
1 parent 58c634b commit 00e5547

23 files changed

+509
-829
lines changed

Diff for: modules/base/tool.go

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ func StringsToInt64s(strs []string) ([]int64, error) {
147147
}
148148
ints := make([]int64, 0, len(strs))
149149
for _, s := range strs {
150+
if s == "" {
151+
continue
152+
}
150153
n, err := strconv.ParseInt(s, 10, 64)
151154
if err != nil {
152155
return nil, err

Diff for: modules/base/tool_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func TestStringsToInt64s(t *testing.T) {
152152
}
153153
testSuccess(nil, nil)
154154
testSuccess([]string{}, []int64{})
155+
testSuccess([]string{""}, []int64{})
155156
testSuccess([]string{"-1234"}, []int64{-1234})
156157
testSuccess([]string{"1", "4", "16", "64", "256"}, []int64{1, 4, 16, 64, 256})
157158

Diff for: modules/container/set.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func (s Set[T]) AddMultiple(values ...T) {
3131
}
3232
}
3333

34-
// Contains determines whether a set contains the specified elements.
35-
// Returns true if the set contains the specified element; otherwise, false.
34+
// Contains determines whether a set contains all these elements.
35+
// Returns true if the set contains all these elements; otherwise, false.
3636
func (s Set[T]) Contains(values ...T) bool {
3737
ret := true
3838
for _, value := range values {

Diff for: modules/container/set_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ func TestSet(t *testing.T) {
1818

1919
assert.True(t, s.Contains("key1"))
2020
assert.True(t, s.Contains("key2"))
21+
assert.True(t, s.Contains("key1", "key2"))
2122
assert.False(t, s.Contains("key3"))
23+
assert.False(t, s.Contains("key1", "key3"))
2224

2325
assert.True(t, s.Remove("key2"))
2426
assert.False(t, s.Contains("key2"))

Diff for: modules/templates/helper.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func NewFuncMap() template.FuncMap {
3131
"ctx": func() any { return nil }, // template context function
3232

3333
"DumpVar": dumpVar,
34+
"NIL": func() any { return nil },
3435

3536
// -----------------------------------------------------------------
3637
// html/template related functions

Diff for: routers/web/repo/compare.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -788,19 +788,11 @@ func CompareDiff(ctx *context.Context) {
788788

789789
if !nothingToCompare {
790790
// Setup information for new form.
791-
retrieveRepoMetasForIssueWriter(ctx, ctx.Repo.Repository, true)
791+
pageMetaData := retrieveRepoIssueMetaData(ctx, ctx.Repo.Repository, nil, true)
792792
if ctx.Written() {
793793
return
794794
}
795-
labelsData := retrieveRepoLabels(ctx, ctx.Repo.Repository, 0, true)
796-
if ctx.Written() {
797-
return
798-
}
799-
RetrieveRepoReviewers(ctx, ctx.Repo.Repository, nil, true)
800-
if ctx.Written() {
801-
return
802-
}
803-
_, templateErrs := setTemplateIfExists(ctx, pullRequestTemplateKey, pullRequestTemplateCandidates, labelsData)
795+
_, templateErrs := setTemplateIfExists(ctx, pullRequestTemplateKey, pullRequestTemplateCandidates, pageMetaData)
804796
if len(templateErrs) > 0 {
805797
ctx.Flash.Warning(renderErrorOfTemplates(ctx, templateErrs), true)
806798
}

0 commit comments

Comments
 (0)