updateUserAccess(): use tighter syntax as suggested by lafriks

This commit is contained in:
Manush Dodunekov 2020-01-09 00:12:43 +01:00
parent 06ad61aad3
commit 10de9b6b89

View File

@ -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)
} }
} }