diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-11-11 04:07:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 04:07:54 +0800 |
commit | a928739456b78072136a1a264a68758571238aac (patch) | |
tree | 6031dfd4eb110262338e3b2636dee445cac63fa7 /modules/container | |
parent | 58c634b8549fb279aec72cecd6a48511803db067 (diff) | |
download | gitea-a928739456b78072136a1a264a68758571238aac.tar.gz gitea-a928739456b78072136a1a264a68758571238aac.zip |
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>
Diffstat (limited to 'modules/container')
-rw-r--r-- | modules/container/set.go | 4 | ||||
-rw-r--r-- | modules/container/set_test.go | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/container/set.go b/modules/container/set.go index adb77dcac7..105533f203 100644 --- a/modules/container/set.go +++ b/modules/container/set.go @@ -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 { diff --git a/modules/container/set_test.go b/modules/container/set_test.go index 1502236034..a8b7ff8190 100644 --- a/modules/container/set_test.go +++ b/modules/container/set_test.go @@ -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")) |