diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-06 15:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-06 15:09:00 +0300 |
commit | 9fc7cdf0b7a3c8c3528ec930f59fde110683d8fd (patch) | |
tree | daddd5806e8a63e7b2fb5d2820ceab9aafe7574c /app/services/alert_management | |
parent | c203c40cda9df83cc33f9d69a24593ef4de1148d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/alert_management')
-rw-r--r-- | app/services/alert_management/update_alert_status_service.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/alert_management/update_alert_status_service.rb b/app/services/alert_management/update_alert_status_service.rb index a7ebddb82e0..427e2e09057 100644 --- a/app/services/alert_management/update_alert_status_service.rb +++ b/app/services/alert_management/update_alert_status_service.rb @@ -18,6 +18,7 @@ module AlertManagement return error_invalid_status unless status_key if alert.update(status_event: status_event) + resolve_todos if resolved? success else error(alert.errors.full_messages.to_sentence) @@ -28,12 +29,16 @@ module AlertManagement attr_reader :alert, :user, :status - delegate :project, to: :alert + delegate :project, :resolved?, to: :alert def allowed? user.can?(:update_alert_management_alert, project) end + def resolve_todos + TodoService.new.resolve_todos_for_target(alert, user) + end + def status_key strong_memoize(:status_key) do AlertManagement::Alert::STATUSES.key(status) |