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
ddb0fb1a
Commit
ddb0fb1a
authored
Jun 24, 2021
by
syasonik
Committed by
Sarah Yasonik
Aug 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor post-issue-update tasks to be more readable
parent
f09b50ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
21 deletions
+28
-21
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+28
-21
No files found.
app/services/issues/update_service.rb
View file @
ddb0fb1a
...
...
@@ -54,28 +54,10 @@ module Issues
end
handle_assignee_changes
(
issue
,
old_assignees
)
if
issue
.
previous_changes
.
include?
(
'confidential'
)
# don't enqueue immediately to prevent todos removal in case of a mistake
TodosDestroyer
::
ConfidentialIssueWorker
.
perform_in
(
Todo
::
WAIT_FOR_DELETE
,
issue
.
id
)
if
issue
.
confidential?
create_confidentiality_note
(
issue
)
track_usage_event
(
:incident_management_incident_change_confidential
,
current_user
.
id
)
end
added_labels
=
issue
.
labels
-
old_labels
if
added_labels
.
present?
notification_service
.
async
.
relabeled_issue
(
issue
,
added_labels
,
current_user
)
end
handle_confidential_change
(
issue
)
handle_added_labels
(
issue
,
old_labels
)
handle_milestone_change
(
issue
)
added_mentions
=
issue
.
mentioned_users
(
current_user
)
-
old_mentioned_users
if
added_mentions
.
present?
notification_service
.
async
.
new_mentions_in_issue
(
issue
,
added_mentions
,
current_user
)
end
handle_added_mentions
(
issue
,
old_mentioned_users
)
handle_severity_change
(
issue
,
old_severity
)
end
...
...
@@ -156,6 +138,23 @@ module Issues
MergeRequests
::
CreateFromIssueService
.
new
(
project:
project
,
current_user:
current_user
,
mr_params:
create_merge_request_params
).
execute
end
def
handle_confidential_change
(
issue
)
if
issue
.
previous_changes
.
include?
(
'confidential'
)
# don't enqueue immediately to prevent todos removal in case of a mistake
TodosDestroyer
::
ConfidentialIssueWorker
.
perform_in
(
Todo
::
WAIT_FOR_DELETE
,
issue
.
id
)
if
issue
.
confidential?
create_confidentiality_note
(
issue
)
track_usage_event
(
:incident_management_incident_change_confidential
,
current_user
.
id
)
end
end
def
handle_added_labels
(
issue
,
old_labels
)
added_labels
=
issue
.
labels
-
old_labels
if
added_labels
.
present?
notification_service
.
async
.
relabeled_issue
(
issue
,
added_labels
,
current_user
)
end
end
def
handle_milestone_change
(
issue
)
return
unless
issue
.
previous_changes
.
include?
(
'milestone_id'
)
...
...
@@ -184,6 +183,14 @@ module Issues
end
end
def
handle_added_mentions
(
issue
,
old_mentioned_users
)
added_mentions
=
issue
.
mentioned_users
(
current_user
)
-
old_mentioned_users
if
added_mentions
.
present?
notification_service
.
async
.
new_mentions_in_issue
(
issue
,
added_mentions
,
current_user
)
end
end
def
handle_severity_change
(
issue
,
old_severity
)
return
unless
old_severity
&&
issue
.
severity
!=
old_severity
...
...
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