Merge branch 'bvl-add-username-to-terms-message' into 'master'
Add username to terms message in git and API calls Closes #46649 See merge request gitlab-org/gitlab-ce!19126
This commit is contained in:
commit
a45b9fc96c
5 changed files with 13 additions and 7 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add username to terms message in git and API calls
|
||||
merge_request: 19126
|
||||
author:
|
||||
type: changed
|
|
@ -8,12 +8,12 @@ module Gitlab
|
|||
def rejection_message
|
||||
case rejection_type
|
||||
when :internal
|
||||
'This action cannot be performed by internal users'
|
||||
"This action cannot be performed by internal users"
|
||||
when :terms_not_accepted
|
||||
'You must accept the Terms of Service in order to perform this action. '\
|
||||
'Please access GitLab from a web browser to accept these terms.'
|
||||
"You (#{@user.to_reference}) must accept the Terms of Service in order to perform this action. "\
|
||||
"Please access GitLab from a web browser to accept these terms."
|
||||
else
|
||||
'Your account has been blocked.'
|
||||
"Your account has been blocked."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ describe Gitlab::Auth::UserAccessDeniedReason do
|
|||
enforce_terms
|
||||
end
|
||||
|
||||
it { is_expected.to match /You must accept the Terms of Service/ }
|
||||
it { is_expected.to match /must accept the Terms of Service/ }
|
||||
it { is_expected.to include(user.username) }
|
||||
end
|
||||
|
||||
context 'when the user is internal' do
|
||||
|
|
|
@ -1055,7 +1055,7 @@ describe Gitlab::GitAccess do
|
|||
|
||||
it 'blocks access when the user did not accept terms', :aggregate_failures do
|
||||
actions.each do |action|
|
||||
expect { action.call }.to raise_unauthorized(/You must accept the Terms of Service in order to perform this action/)
|
||||
expect { action.call }.to raise_unauthorized(/must accept the Terms of Service in order to perform this action/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ describe API::Helpers do
|
|||
end
|
||||
|
||||
it 'returns a 403 when a user has not accepted the terms' do
|
||||
expect { current_user }.to raise_error /You must accept the Terms of Service/
|
||||
expect { current_user }.to raise_error /must accept the Terms of Service/
|
||||
end
|
||||
|
||||
it 'sets the current user when the user accepted the terms' do
|
||||
|
|
Loading…
Reference in a new issue