Class: AlertManagement::Alerts::UpdateService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- AlertManagement::Alerts::UpdateService
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/alert_management/alerts/update_service.rb
Instance Attribute Summary
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(alert, current_user, params) ⇒ UpdateService
constructor
A new instance of UpdateService.
Methods inherited from BaseContainerService
#group_container?, #namespace_container?, #project_container?, #project_group, #root_ancestor
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(alert, current_user, params) ⇒ UpdateService
Returns a new instance of UpdateService.
11 12 13 14 15 16 17 |
# File 'app/services/alert_management/alerts/update_service.rb', line 11 def initialize(alert, current_user, params) @alert = alert @param_errors = [] @status = params.delete(:status) super(project: alert.project, current_user: current_user, params: params) end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/alert_management/alerts/update_service.rb', line 19 def execute return unless allowed? filter_params return error_invalid_params if param_errors.any? # Save old assignees for system notes old_assignees = alert.assignees.to_a if alert.update(params) handle_changes(old_assignees: old_assignees) success else error(alert.errors..to_sentence) end end |