Commit b4b91b2c authored by Serena Fang's avatar Serena Fang

Update api docs

Also change error message
parent a63fcabf
...@@ -33,7 +33,7 @@ module Users ...@@ -33,7 +33,7 @@ module Users
end end
def state_error(user) def state_error(user)
error(_("You cannot %{action} a %{state} user." % { action: action.to_s, state: user.state }), :forbidden) error(_("You cannot %{action} %{state} users." % { action: action.to_s, state: user.state }), :forbidden)
end end
def allowed? def allowed?
......
...@@ -1485,7 +1485,7 @@ Returns: ...@@ -1485,7 +1485,7 @@ Returns:
- `201 OK` on success. - `201 OK` on success.
- `404 User Not Found` if user cannot be found. - `404 User Not Found` if user cannot be found.
- `403 Forbidden` when trying to ban a user that is blocked by LDAP synchronization or is deactivated. - `403 Forbidden` when trying to ban a user that is not active.
## Unban user ## Unban user
...@@ -1505,7 +1505,7 @@ Returns: ...@@ -1505,7 +1505,7 @@ Returns:
- `201 OK` on success. - `201 OK` on success.
- `404 User Not Found` if the user cannot be found. - `404 User Not Found` if the user cannot be found.
- `403 Forbidden` when trying to unban a user that is blocked by LDAP synchronization or is deactivated. - `403 Forbidden` when trying to unban a user that is not banned.
### Get user contribution events ### Get user contribution events
......
...@@ -38218,7 +38218,7 @@ msgstr "" ...@@ -38218,7 +38218,7 @@ msgstr ""
msgid "You can view the source or %{linkStart}%{cloneIcon} clone the repository%{linkEnd}" msgid "You can view the source or %{linkStart}%{cloneIcon} clone the repository%{linkEnd}"
msgstr "" msgstr ""
msgid "You cannot %{action} a %{state} user." msgid "You cannot %{action} %{state} users."
msgstr "" msgstr ""
msgid "You cannot access the raw file. Please wait a minute." msgid "You cannot access the raw file. Please wait a minute."
......
...@@ -2989,7 +2989,7 @@ RSpec.describe API::Users do ...@@ -2989,7 +2989,7 @@ RSpec.describe API::Users do
ban_user ban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot ban a ldap_blocked user.') expect(json_response['message']).to eq('You cannot ban ldap_blocked users.')
expect(ldap_blocked_user.reload.state).to eq('ldap_blocked') expect(ldap_blocked_user.reload.state).to eq('ldap_blocked')
end end
end end
...@@ -3001,7 +3001,7 @@ RSpec.describe API::Users do ...@@ -3001,7 +3001,7 @@ RSpec.describe API::Users do
ban_user ban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot ban a deactivated user.') expect(json_response['message']).to eq('You cannot ban deactivated users.')
expect(deactivated_user.reload.state).to eq('deactivated') expect(deactivated_user.reload.state).to eq('deactivated')
end end
end end
...@@ -3013,7 +3013,7 @@ RSpec.describe API::Users do ...@@ -3013,7 +3013,7 @@ RSpec.describe API::Users do
ban_user ban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot ban a banned user.') expect(json_response['message']).to eq('You cannot ban banned users.')
expect(banned_user.reload.state).to eq('banned') expect(banned_user.reload.state).to eq('banned')
end end
end end
...@@ -3070,7 +3070,7 @@ RSpec.describe API::Users do ...@@ -3070,7 +3070,7 @@ RSpec.describe API::Users do
unban_user unban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot unban a ldap_blocked user.') expect(json_response['message']).to eq('You cannot unban ldap_blocked users.')
expect(ldap_blocked_user.reload.state).to eq('ldap_blocked') expect(ldap_blocked_user.reload.state).to eq('ldap_blocked')
end end
end end
...@@ -3082,7 +3082,7 @@ RSpec.describe API::Users do ...@@ -3082,7 +3082,7 @@ RSpec.describe API::Users do
unban_user unban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot unban a deactivated user.') expect(json_response['message']).to eq('You cannot unban deactivated users.')
expect(deactivated_user.reload.state).to eq('deactivated') expect(deactivated_user.reload.state).to eq('deactivated')
end end
end end
...@@ -3094,7 +3094,7 @@ RSpec.describe API::Users do ...@@ -3094,7 +3094,7 @@ RSpec.describe API::Users do
unban_user unban_user
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('You cannot unban a active user.') expect(json_response['message']).to eq('You cannot unban active users.')
expect(user.reload.state).to eq('active') expect(user.reload.state).to eq('active')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment