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
end
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
def allowed?
......
......@@ -1485,7 +1485,7 @@ Returns:
- `201 OK` on success.
- `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
......@@ -1505,7 +1505,7 @@ Returns:
- `201 OK` on success.
- `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
......
......@@ -38218,7 +38218,7 @@ msgstr ""
msgid "You can view the source or %{linkStart}%{cloneIcon} clone the repository%{linkEnd}"
msgstr ""
msgid "You cannot %{action} a %{state} user."
msgid "You cannot %{action} %{state} users."
msgstr ""
msgid "You cannot access the raw file. Please wait a minute."
......
......@@ -2989,7 +2989,7 @@ RSpec.describe API::Users do
ban_user
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')
end
end
......@@ -3001,7 +3001,7 @@ RSpec.describe API::Users do
ban_user
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')
end
end
......@@ -3013,7 +3013,7 @@ RSpec.describe API::Users do
ban_user
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')
end
end
......@@ -3070,7 +3070,7 @@ RSpec.describe API::Users do
unban_user
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')
end
end
......@@ -3082,7 +3082,7 @@ RSpec.describe API::Users do
unban_user
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')
end
end
......@@ -3094,7 +3094,7 @@ RSpec.describe API::Users do
unban_user
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')
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