Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5b0a2782
Commit
5b0a2782
authored
Mar 01, 2020
by
Aleksandrs Ļedovskis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit display of notification broadcast messages in Git post-receive reply
parent
69991f26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
app/services/post_receive_service.rb
app/services/post_receive_service.rb
+1
-1
changelogs/unreleased/limit-broadcast-notifications-to-ui.yml
...gelogs/unreleased/limit-broadcast-notifications-to-ui.yml
+5
-0
spec/factories/broadcast_messages.rb
spec/factories/broadcast_messages.rb
+6
-0
spec/services/post_receive_service_spec.rb
spec/services/post_receive_service_spec.rb
+10
-2
No files found.
app/services/post_receive_service.rb
View file @
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
)
...
...
changelogs/unreleased/limit-broadcast-notifications-to-ui.yml
0 → 100644
View file @
5b0a2782
---
title
:
Limit notification-type broadcast display to web interface
merge_request
:
26236
author
:
Aleksandrs Ļedovskis
type
:
changed
spec/factories/broadcast_messages.rb
View file @
5b0a2782
...
...
@@ -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
spec/services/post_receive_service_spec.rb
View file @
5b0a2782
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment