BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7ea12d80
Commit
7ea12d80
authored
May 09, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mrchrisw-fix-slack-notify' into 'master'
Fix notify_only_default_branch check for Slack service See merge request !11154
parents
8db76243
52c8651a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
chat_notification_service.rb
app/models/project_services/chat_notification_service.rb
+1
-1
mrchrisw-fix-slack-notify.yml
changelogs/unreleased/mrchrisw-fix-slack-notify.yml
+4
-0
slack_mattermost_notifications_shared_examples.rb
...support/slack_mattermost_notifications_shared_examples.rb
+13
-1
No files found.
app/models/project_services/chat_notification_service.rb
View file @
7ea12d80
...
@@ -150,7 +150,7 @@ class ChatNotificationService < Service
...
@@ -150,7 +150,7 @@ class ChatNotificationService < Service
def
notify_for_ref?
(
data
)
def
notify_for_ref?
(
data
)
return
true
if
data
[
:object_attributes
][
:tag
]
return
true
if
data
[
:object_attributes
][
:tag
]
return
true
unless
notify_only_default_branch
return
true
unless
notify_only_default_branch
?
data
[
:object_attributes
][
:ref
]
==
project
.
default_branch
data
[
:object_attributes
][
:ref
]
==
project
.
default_branch
end
end
...
...
changelogs/unreleased/mrchrisw-fix-slack-notify.yml
0 → 100644
View file @
7ea12d80
---
title
:
Fix notify_only_default_branch check for Slack service
merge_request
:
author
:
spec/support/slack_mattermost_notifications_shared_examples.rb
View file @
7ea12d80
...
@@ -328,7 +328,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
...
@@ -328,7 +328,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
context
'only notify for the default branch'
do
context
'only notify for the default branch'
do
context
'when enabled'
do
context
'when enabled'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
status:
'failed'
,
ref:
'not-the-default-branch'
)
create
(
:ci_pipeline
,
:failed
,
project:
project
,
ref:
'not-the-default-branch'
)
end
end
before
do
before
do
...
@@ -342,6 +342,18 @@ RSpec.shared_examples 'slack or mattermost notifications' do
...
@@ -342,6 +342,18 @@ RSpec.shared_examples 'slack or mattermost notifications' do
expect
(
result
).
to
be_falsy
expect
(
result
).
to
be_falsy
end
end
end
end
context
'when disabled'
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
:failed
,
project:
project
,
ref:
'not-the-default-branch'
)
end
before
do
chat_service
.
notify_only_default_branch
=
false
end
it_behaves_like
'call Slack/Mattermost API'
end
end
end
end
end
end
end
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