Commit 5c6c8973 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'bvl-remove-broadcase-messages-endpoint' into 'master'

Remove broadcast messages from internal API.

Closes #33623

See merge request gitlab-org/gitlab!18267
parents 134d6e39 d6af135f
......@@ -215,17 +215,6 @@ Example response:
- GitLab Geo
- GitLab-shell's `bin/check`
## Broadcast message(s) [NOT USED]
```
GET /internal/broadcast_message
GET /internal/broadcast_messages
```
**Deprecated:** This used to be used by GitLab-shell to print out broadcast
messages. But this is now included in the `post_receive` call. Other
clients can use the public BroadcastMessages API.
## Get new 2FA recovery codes using an SSH key
This is called from GitLab-shell and allows users to get new 2FA
......
......@@ -148,22 +148,6 @@ module API
}
end
get "/broadcast_messages" do
if messages = BroadcastMessage.current
present messages, with: Entities::BroadcastMessage
else
[]
end
end
get "/broadcast_message" do
if message = BroadcastMessage.current&.last
present message, with: Entities::BroadcastMessage
else
{}
end
end
# rubocop: disable CodeReuse/ActiveRecord
post '/two_factor_recovery_codes' do
status 200
......
......@@ -43,61 +43,6 @@ describe API::Internal::Base do
end
end
describe 'GET /internal/broadcast_message' do
context 'broadcast message exists' do
let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
it 'returns one broadcast message' do
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response['message']).to eq(broadcast_message.message)
end
end
context 'broadcast message does not exist' do
it 'returns nothing' do
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
context 'nil broadcast message' do
it 'returns nothing' do
allow(BroadcastMessage).to receive(:current).and_return(nil)
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
end
describe 'GET /internal/broadcast_messages' do
context 'broadcast message(s) exist' do
let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
it 'returns active broadcast message(s)' do
get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response[0]['message']).to eq(broadcast_message.message)
end
end
context 'broadcast message does not exist' do
it 'returns nothing' do
get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
end
describe 'GET /internal/two_factor_recovery_codes' do
it 'returns an error message when the key does not exist' do
post api('/internal/two_factor_recovery_codes'),
......
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