diff options
author | zeripath <art27@cantab.net> | 2020-08-20 08:48:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 10:48:40 +0300 |
commit | d15bb17b78f8aee3285b5fadf924ac2dc569f790 (patch) | |
tree | 0bfddd906fc953a42e17bdd5cb1f75bf3ce683dc /models | |
parent | dcb543ac2a9cccc16dd161c820a4a002e8a83e82 (diff) | |
download | gitea-d15bb17b78f8aee3285b5fadf924ac2dc569f790.tar.gz gitea-d15bb17b78f8aee3285b5fadf924ac2dc569f790.zip |
Default empty merger list to those with write permissions (#12535)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/branches.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/models/branches.go b/models/branches.go index fc3c783b3a..38aa79d2dc 100644 --- a/models/branches.go +++ b/models/branches.go @@ -98,9 +98,10 @@ func (protectBranch *ProtectedBranch) CanUserPush(userID int64) bool { } // IsUserMergeWhitelisted checks if some user is whitelisted to merge to this branch -func (protectBranch *ProtectedBranch) IsUserMergeWhitelisted(userID int64) bool { +func (protectBranch *ProtectedBranch) IsUserMergeWhitelisted(userID int64, permissionInRepo Permission) bool { if !protectBranch.EnableMergeWhitelist { - return true + // Then we need to fall back on whether the user has write permission + return permissionInRepo.CanWrite(UnitTypeCode) } if base.Int64sContains(protectBranch.MergeWhitelistUserIDs, userID) { |