Commit f1e37610 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'feature/limit-broadcast-notifications-to-ui' into 'master'

Limit display of notification broadcast messages in Git post-receive reply

See merge request gitlab-org/gitlab!26236
parents f26a9e19 5b0a2782
......@@ -28,7 +28,7 @@ class PostReceiveService
response.add_alert_message(message)
end
broadcast_message = BroadcastMessage.current&.last&.message
broadcast_message = BroadcastMessage.current_banner_messages&.last&.message
response.add_alert_message(broadcast_message)
response.add_merge_request_urls(merge_request_urls)
......
---
title: Limit notification-type broadcast display to web interface
merge_request: 26236
author: Aleksandrs Ļedovskis
type: changed
......@@ -6,6 +6,8 @@ FactoryBot.define do
starts_at { 1.day.ago }
ends_at { 1.day.from_now }
broadcast_type { :banner }
trait :expired do
starts_at { 5.days.ago }
ends_at { 3.days.ago }
......@@ -15,5 +17,9 @@ FactoryBot.define do
starts_at { 5.days.from_now }
ends_at { 6.days.from_now }
end
trait :notification do
broadcast_type { :notification }
end
end
end
......@@ -130,14 +130,22 @@ describe PostReceiveService do
end
end
context 'broadcast message exists' do
context 'broadcast message banner exists' do
it 'outputs a broadcast message' do
broadcast_message = create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now)
broadcast_message = create(:broadcast_message)
expect(subject).to include(build_alert_message(broadcast_message.message))
end
end
context 'broadcast message notification exists' do
it 'does not output a broadcast message' do
create(:broadcast_message, :notification)
expect(has_alert_messages?(subject)).to be_falsey
end
end
context 'broadcast message does not exist' do
it 'does not output a broadcast message' do
expect(has_alert_messages?(subject)).to be_falsey
......
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