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
3fc60058
Commit
3fc60058
authored
Jan 21, 2020
by
Sean Arnold
Committed by
Douglas Barbosa Alexandre
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up code and remove duplicate method
- Move cache key to new method - Memoize related_issue
parent
156baa54
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
app/models/error_tracking/project_error_tracking_setting.rb
app/models/error_tracking/project_error_tracking_setting.rb
+9
-4
app/services/error_tracking/issue_update_service.rb
app/services/error_tracking/issue_update_service.rb
+8
-7
app/services/system_note_service.rb
app/services/system_note_service.rb
+0
-6
No files found.
app/models/error_tracking/project_error_tracking_setting.rb
View file @
3fc60058
...
...
@@ -140,15 +140,20 @@ module ErrorTracking
Addressable
::
URI
.
join
(
api_url
,
'/'
).
to_s
end
def
clear_cache
(
key
_prefix
)
r
eturn
unless
key
_prefix
def
clear_cache
(
resource
_prefix
)
r
aise
'No resource prefix provided'
unless
resource
_prefix
klass_key
=
self
.
class
.
reactive_cache_key
.
call
(
self
).
join
(
':'
)
Rails
.
cache
.
delete_matched
(
"
#{
klass_key
}
:
#{
key_prefix
}
*"
)
Rails
.
cache
.
delete_matched
(
cache_key
(
resource_prefix
))
end
private
def
cache_key
(
resource_prefix
)
klass_key
=
self
.
class
.
reactive_cache_key
.
call
(
self
).
join
(
':'
)
"
#{
klass_key
}
:
#{
resource_prefix
}
*"
end
def
add_gitlab_issue_details
(
issue
)
issue
.
gitlab_commit
=
match_gitlab_commit
(
issue
.
first_release_version
)
issue
.
gitlab_commit_path
=
project_commit_path
(
project
,
issue
.
gitlab_commit
)
if
issue
.
gitlab_commit
...
...
app/services/error_tracking/issue_update_service.rb
View file @
3fc60058
...
...
@@ -23,10 +23,9 @@ module ErrorTracking
end
def
update_related_issue
issue
=
related_issue
return
unless
issue
return
if
related_issue
.
nil?
close_and_create_note
(
issue
)
close_and_create_note
(
related_
issue
)
end
def
clear_cache
...
...
@@ -54,11 +53,13 @@ module ErrorTracking
end
def
related_issue
strong_memoize
(
:related_issue
)
do
SentryIssueFinder
.
new
(
project
,
current_user:
current_user
)
.
execute
(
params
[
:issue_id
])
&
.
issue
end
end
def
resolving?
update_params
[
:status
]
==
'resolved'
...
...
app/services/system_note_service.rb
View file @
3fc60058
...
...
@@ -105,12 +105,6 @@ module SystemNoteService
create_note
(
NoteSummary
.
new
(
issue
,
project
,
author
,
body
,
action:
'closed'
))
end
def
close_after_error_tracking_resolve
(
issue
,
project
,
author
)
body
=
_
(
'resolved the corresponding error and closed the issue.'
)
create_note
(
NoteSummary
.
new
(
issue
,
project
,
author
,
body
,
action:
'closed'
))
end
def
change_status
(
noteable
,
project
,
author
,
status
,
source
=
nil
)
::
SystemNotes
::
IssuablesService
.
new
(
noteable:
noteable
,
project:
project
,
author:
author
).
change_status
(
status
,
source
)
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