From d15bb17b78f8aee3285b5fadf924ac2dc569f790 Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 20 Aug 2020 08:48:40 +0100 Subject: Default empty merger list to those with write permissions (#12535) Signed-off-by: Andrew Thornton Co-authored-by: Lunny Xiao --- models/branches.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'models') 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) { -- cgit v1.2.3