mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-04 00:14:29 +00:00
fix: make auth source group sync correctly handle team removal (#37161)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -52,6 +52,28 @@ func (s Set[T]) Remove(value T) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// RemoveFromSet removes the specified elements from the set.
|
||||
// Returns the number of elements successfully removed.
|
||||
func (s Set[T]) RemoveFromSet(o Set[T]) (n int) {
|
||||
for value := range o {
|
||||
if s.Remove(value) {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// RemoveFromSlice removes the specified elements from the slice.
|
||||
// Returns the number of elements successfully removed.
|
||||
func (s Set[T]) RemoveFromSlice(o []T) (n int) {
|
||||
for _, value := range o {
|
||||
if s.Remove(value) {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// Values gets a list of all elements in the set.
|
||||
func (s Set[T]) Values() []T {
|
||||
keys := make([]T, 0, len(s))
|
||||
|
||||
Reference in New Issue
Block a user