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
c428b294
Commit
c428b294
authored
May 10, 2021
by
Andy Soiron
Committed by
Markus Koller
May 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix allow_blank for chat notification validation
Changelog: fixed
parent
5d8d5142
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
app/models/project_services/chat_notification_service.rb
app/models/project_services/chat_notification_service.rb
+1
-1
changelogs/unreleased/fix-slack-label-filter-behavior-blank.yml
...logs/unreleased/fix-slack-label-filter-behavior-blank.yml
+5
-0
spec/models/project_services/chat_notification_service_spec.rb
...models/project_services/chat_notification_service_spec.rb
+17
-1
No files found.
app/models/project_services/chat_notification_service.rb
View file @
c428b294
...
...
@@ -30,7 +30,7 @@ class ChatNotificationService < Service
boolean_accessor
:notify_only_broken_pipelines
,
:notify_only_default_branch
validates
:webhook
,
presence:
true
,
public_url:
true
,
if: :activated?
validates
:labels_to_be_notified_behavior
,
inclusion:
{
in:
LABEL_NOTIFICATION_BEHAVIOURS
},
allow_
nil
:
true
validates
:labels_to_be_notified_behavior
,
inclusion:
{
in:
LABEL_NOTIFICATION_BEHAVIOURS
},
allow_
blank
:
true
def
initialize_properties
if
properties
.
nil?
...
...
changelogs/unreleased/fix-slack-label-filter-behavior-blank.yml
0 → 100644
View file @
c428b294
---
title
:
Fix slack label filter behavior blank
merge_request
:
61236
author
:
type
:
fixed
spec/models/project_services/chat_notification_service_spec.rb
View file @
c428b294
...
...
@@ -12,7 +12,7 @@ RSpec.describe ChatNotificationService do
end
describe
'validations'
do
it
{
is_expected
.
to
validate_inclusion_of
(
:labels_to_be_notified_behavior
).
in_array
(
%w[match_any match_all]
)
}
it
{
is_expected
.
to
validate_inclusion_of
(
:labels_to_be_notified_behavior
).
in_array
(
%w[match_any match_all]
)
.
allow_blank
}
end
describe
'#can_test?'
do
...
...
@@ -127,6 +127,22 @@ RSpec.describe ChatNotificationService do
end
end
context
'when labels_to_be_notified_behavior is blank'
do
subject
(
:chat_service
)
{
described_class
.
new
(
labels_to_be_notified:
label_filter
,
labels_to_be_notified_behavior:
''
)
}
context
'no matching labels'
do
let
(
:label_filter
)
{
'~some random label'
}
it_behaves_like
'does not notify the chat service'
end
context
'only one label matches'
do
let
(
:label_filter
)
{
'~some random label, ~Bug'
}
it_behaves_like
'notifies the chat service'
end
end
context
'when labels_to_be_notified_behavior is match_any'
do
subject
(
:chat_service
)
do
described_class
.
new
(
...
...
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