diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-23 00:12:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-23 00:12:24 +0300 |
commit | c4a9ca5ffca17bd874dd77014e9f2d607c94b06c (patch) | |
tree | a4abbf721a24cc0c362d225ca52441124f56c00b /app/services/members | |
parent | a3ffaa242bb3b9b4c95a8223ca800126887e3a82 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/members')
-rw-r--r-- | app/services/members/update_service.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/services/members/update_service.rb b/app/services/members/update_service.rb index b4d1b80e5a3..8ef3e307519 100644 --- a/app/services/members/update_service.rb +++ b/app/services/members/update_service.rb @@ -7,6 +7,8 @@ module Members raise Gitlab::Access::AccessDeniedError unless can?(current_user, action_member_permission(permission, member), member) raise Gitlab::Access::AccessDeniedError if prevent_upgrade_to_owner?(member) || prevent_downgrade_from_owner?(member) + return success(member: member) if update_results_in_no_change?(member) + old_access_level = member.human_access old_expiry = member.expires_at @@ -26,6 +28,13 @@ module Members private + def update_results_in_no_change?(member) + return false if params[:expires_at]&.to_date != member.expires_at + return false if params[:access_level] != member.access_level + + true + end + def downgrading_to_guest? params[:access_level] == Gitlab::Access::GUEST end |