mirror of
https://github.com/go-gitea/gitea
synced 2025-01-03 11:26:01 +01:00
updateUserAccess(): use tighter syntax as suggested by lafriks
This commit is contained in:
parent
06ad61aad3
commit
10de9b6b89
@ -177,12 +177,11 @@ type userAccess struct {
|
|||||||
|
|
||||||
// updateUserAccess updates an access map so that user has at least mode
|
// updateUserAccess updates an access map so that user has at least mode
|
||||||
func updateUserAccess(accessMap map[int64]*userAccess, user *User, mode AccessMode) {
|
func updateUserAccess(accessMap map[int64]*userAccess, user *User, mode AccessMode) {
|
||||||
ua, ok := accessMap[user.ID]
|
if ua, ok := accessMap[user.ID]; ok {
|
||||||
if !ok {
|
ua.Mode = maxAccessMode(ua.Mode, mode)
|
||||||
|
} else {
|
||||||
ua = &userAccess{User: user, Mode: mode}
|
ua = &userAccess{User: user, Mode: mode}
|
||||||
accessMap[user.ID] = ua
|
accessMap[user.ID] = ua
|
||||||
} else {
|
|
||||||
ua.Mode = maxAccessMode(ua.Mode, mode)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user