mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor sidebar assignee&milestone&project selectors (#32465)
Follow #32460 Now the code could be much clearer than before and easier to maintain. A lot of legacy code is removed. Manually tested. This PR is large enough, that fine tunes could be deferred to the future if there is no bug found or design problem. Screenshots: <details>  </details>
This commit is contained in:
@@ -147,6 +147,9 @@ func StringsToInt64s(strs []string) ([]int64, error) {
|
||||
}
|
||||
ints := make([]int64, 0, len(strs))
|
||||
for _, s := range strs {
|
||||
if s == "" {
|
||||
continue
|
||||
}
|
||||
n, err := strconv.ParseInt(s, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@@ -152,6 +152,7 @@ func TestStringsToInt64s(t *testing.T) {
|
||||
}
|
||||
testSuccess(nil, nil)
|
||||
testSuccess([]string{}, []int64{})
|
||||
testSuccess([]string{""}, []int64{})
|
||||
testSuccess([]string{"-1234"}, []int64{-1234})
|
||||
testSuccess([]string{"1", "4", "16", "64", "256"}, []int64{1, 4, 16, 64, 256})
|
||||
|
||||
|
@@ -31,8 +31,8 @@ func (s Set[T]) AddMultiple(values ...T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Contains determines whether a set contains the specified elements.
|
||||
// Returns true if the set contains the specified element; otherwise, false.
|
||||
// Contains determines whether a set contains all these elements.
|
||||
// Returns true if the set contains all these elements; otherwise, false.
|
||||
func (s Set[T]) Contains(values ...T) bool {
|
||||
ret := true
|
||||
for _, value := range values {
|
||||
|
@@ -18,7 +18,9 @@ func TestSet(t *testing.T) {
|
||||
|
||||
assert.True(t, s.Contains("key1"))
|
||||
assert.True(t, s.Contains("key2"))
|
||||
assert.True(t, s.Contains("key1", "key2"))
|
||||
assert.False(t, s.Contains("key3"))
|
||||
assert.False(t, s.Contains("key1", "key3"))
|
||||
|
||||
assert.True(t, s.Remove("key2"))
|
||||
assert.False(t, s.Contains("key2"))
|
||||
|
@@ -31,6 +31,7 @@ func NewFuncMap() template.FuncMap {
|
||||
"ctx": func() any { return nil }, // template context function
|
||||
|
||||
"DumpVar": dumpVar,
|
||||
"NIL": func() any { return nil },
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// html/template related functions
|
||||
|
Reference in New Issue
Block a user