diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 03:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 03:09:04 +0300 |
commit | 27a18afc7dba4e09a5ec78e5c251c31216d7792a (patch) | |
tree | 5dcc015be79e00de4133a66defe10bf1463ff827 /app/services | |
parent | 71c9d577ad563572050335dc261ba7673e3e566f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/error_tracking/issue_details_service.rb | 25 | ||||
-rw-r--r-- | app/services/error_tracking/issue_update_service.rb | 18 |
2 files changed, 31 insertions, 12 deletions
diff --git a/app/services/error_tracking/issue_details_service.rb b/app/services/error_tracking/issue_details_service.rb index ee6d556518b..0068a9e9b6d 100644 --- a/app/services/error_tracking/issue_details_service.rb +++ b/app/services/error_tracking/issue_details_service.rb @@ -2,12 +2,35 @@ module ErrorTracking class IssueDetailsService < ErrorTracking::BaseService + include Gitlab::Routing + include Gitlab::Utils::StrongMemoize + private def perform response = project_error_tracking_setting.issue_details(issue_id: params[:issue_id]) - compose_response(response) + compose_response(response) do + # The gitlab_issue attribute can contain an absolute GitLab url from the Sentry Client + # here we overwrite that in favor of our own data if we have it + response[:issue].gitlab_issue = gitlab_issue_url if gitlab_issue_url + end + end + + def gitlab_issue_url + strong_memoize(:gitlab_issue_url) do + # Use the absolute url to match the GitLab issue url that the Sentry api provides + project_issue_url(project, gitlab_issue.iid) if gitlab_issue + end + end + + def gitlab_issue + strong_memoize(:gitlab_issue) do + SentryIssueFinder + .new(project, current_user: current_user) + .execute(params[:issue_id]) + &.issue + end end def parse_response(response) diff --git a/app/services/error_tracking/issue_update_service.rb b/app/services/error_tracking/issue_update_service.rb index 904aed27684..e516ac95138 100644 --- a/app/services/error_tracking/issue_update_service.rb +++ b/app/services/error_tracking/issue_update_service.rb @@ -2,8 +2,6 @@ module ErrorTracking class IssueUpdateService < ErrorTracking::BaseService - include ::Gitlab::Utils::StrongMemoize - private def perform @@ -14,14 +12,14 @@ module ErrorTracking compose_response(response) do response[:closed_issue_iid] = update_related_issue&.iid - project_error_tracking_setting.expire_issues_cache end end def update_related_issue - return if related_issue.nil? + issue = related_issue + return unless issue - close_and_create_note(related_issue) + close_and_create_note(issue) end def close_and_create_note(issue) @@ -45,12 +43,10 @@ module ErrorTracking end def related_issue - strong_memoize(:related_issue) do - SentryIssueFinder - .new(project, current_user: current_user) - .execute(params[:issue_id]) - &.issue - end + SentryIssueFinder + .new(project, current_user: current_user) + .execute(params[:issue_id]) + &.issue end def resolving? |