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
b2b5f567
Commit
b2b5f567
authored
Oct 02, 2020
by
Vitali Tatarintev
Committed by
Peter Leitzen
Oct 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove add severity system note feature flag
parent
41a3dd23
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
51 deletions
+27
-51
app/services/system_notes/incident_service.rb
app/services/system_notes/incident_service.rb
+0
-2
changelogs/unreleased/remove-add_severity_system_note-feature-flag.yml
...released/remove-add_severity_system_note-feature-flag.yml
+5
-0
config/feature_flags/development/add_severity_system_note.yml
...ig/feature_flags/development/add_severity_system_note.yml
+0
-7
spec/services/system_notes/incident_service_spec.rb
spec/services/system_notes/incident_service_spec.rb
+22
-42
No files found.
app/services/system_notes/incident_service.rb
View file @
b2b5f567
...
@@ -10,8 +10,6 @@ module SystemNotes
...
@@ -10,8 +10,6 @@ module SystemNotes
#
#
# Returns the created Note object
# Returns the created Note object
def
change_incident_severity
def
change_incident_severity
return
unless
Feature
.
enabled?
(
:add_severity_system_note
,
noteable
.
project
)
severity
=
noteable
.
severity
severity
=
noteable
.
severity
if
severity_label
=
IssuableSeverity
::
SEVERITY_LABELS
[
severity
.
to_sym
]
if
severity_label
=
IssuableSeverity
::
SEVERITY_LABELS
[
severity
.
to_sym
]
...
...
changelogs/unreleased/remove-add_severity_system_note-feature-flag.yml
0 → 100644
View file @
b2b5f567
---
title
:
Add system note on incident severity change
merge_request
:
43998
author
:
type
:
added
config/feature_flags/development/add_severity_system_note.yml
deleted
100644 → 0
View file @
41a3dd23
---
name
:
add_severity_system_note
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42358
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/251110
group
:
group::health
type
:
development
default_enabled
:
false
spec/services/system_notes/incident_service_spec.rb
View file @
b2b5f567
...
@@ -15,64 +15,44 @@ RSpec.describe ::SystemNotes::IncidentService do
...
@@ -15,64 +15,44 @@ RSpec.describe ::SystemNotes::IncidentService do
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
and_call_original
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
and_call_original
end
end
context
'with add_severity_system_note feature flag enabled'
do
it_behaves_like
'a system note'
do
before
do
let
(
:action
)
{
'severity'
}
stub_feature_flags
(
add_severity_system_note:
project
)
end
end
it_behaves_like
'a system note'
do
let
(
:action
)
{
'severity'
}
end
IssuableSeverity
.
severities
.
keys
.
each
do
|
severity
|
context
"with
#{
severity
}
severity"
do
before
do
issuable_severity
.
update!
(
severity:
severity
)
end
it
'has the appropriate message'
do
severity_label
=
IssuableSeverity
::
SEVERITY_LABELS
.
fetch
(
severity
.
to_sym
)
expect
(
change_severity
.
note
).
to
eq
(
"changed the severity to **
#{
severity_label
}
**"
)
end
end
end
context
'when severity is invalid'
do
let
(
:invalid_severity
)
{
'invalid-severity'
}
IssuableSeverity
.
severities
.
keys
.
each
do
|
severity
|
context
"with
#{
severity
}
severity"
do
before
do
before
do
allow
(
noteable
).
to
receive
(
:severity
).
and_return
(
invalid_
severity
)
issuable_severity
.
update!
(
severity:
severity
)
end
end
it
'does not create system note'
do
it
'has the appropriate message'
do
expect
{
change_severity
}.
not_to
change
{
noteable
.
notes
.
count
}
severity_label
=
IssuableSeverity
::
SEVERITY_LABELS
.
fetch
(
severity
.
to_sym
)
end
it
'writes error to logs'
do
expect
(
change_severity
.
note
).
to
eq
(
"changed the severity to **
#{
severity_label
}
**"
)
change_severity
expect
(
Gitlab
::
AppLogger
).
to
have_received
(
:error
).
with
(
message:
'Cannot create a system note for severity change'
,
noteable_class:
noteable
.
class
.
to_s
,
noteable_id:
noteable
.
id
,
severity:
invalid_severity
)
end
end
end
end
end
end
context
'with add_severity_system_note feature flag disabled'
do
context
'when severity is invalid'
do
let
(
:invalid_severity
)
{
'invalid-severity'
}
before
do
before
do
stub_feature_flags
(
add_severity_system_note:
false
)
allow
(
noteable
).
to
receive
(
:severity
).
and_return
(
invalid_severity
)
end
end
it
'does not create system note'
do
it
'does not create system note'
do
expect
{
change_severity
}.
not_to
change
{
noteable
.
notes
.
count
}
expect
{
change_severity
}.
not_to
change
{
noteable
.
notes
.
count
}
end
end
it
'does not write error to logs'
do
it
'writes error to logs'
do
expect
(
Gitlab
::
AppLogger
).
not_to
have_received
(
:error
)
change_severity
expect
(
Gitlab
::
AppLogger
).
to
have_received
(
:error
).
with
(
message:
'Cannot create a system note for severity change'
,
noteable_class:
noteable
.
class
.
to_s
,
noteable_id:
noteable
.
id
,
severity:
invalid_severity
)
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