Class: MergeRequests::PushOptionsHandlerService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- MergeRequests::PushOptionsHandlerService
- Defined in:
- app/services/merge_requests/push_options_handler_service.rb
Constant Summary collapse
- LIMIT =
10
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#push_options ⇒ Object
readonly
Returns the value of attribute push_options.
-
#target_project ⇒ Object
readonly
Returns the value of attribute target_project.
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project:, current_user:, changes:, push_options:, params: {}) ⇒ PushOptionsHandlerService
constructor
A new instance of PushOptionsHandlerService.
Methods inherited from BaseContainerService
#group_container?, #namespace_container?, #project_container?, #project_group
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(project:, current_user:, changes:, push_options:, params: {}) ⇒ PushOptionsHandlerService
Returns a new instance of PushOptionsHandlerService.
9 10 11 12 13 14 15 16 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 9 def initialize(project:, current_user:, changes:, push_options:, params: {}) super(project: project, current_user: current_user, params: params) @target_project = @project.default_merge_request_target @changes = Gitlab::ChangesList.new(changes) @push_options = @errors = [] end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
7 8 9 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 7 def changes @changes end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 7 def errors @errors end |
#push_options ⇒ Object (readonly)
Returns the value of attribute push_options.
7 8 9 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 7 def @push_options end |
#target_project ⇒ Object (readonly)
Returns the value of attribute target_project.
7 8 9 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 7 def target_project @target_project end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/merge_requests/push_options_handler_service.rb', line 18 def execute validate_service return self if errors.present? branches.each do |branch| execute_for_branch(branch) rescue Gitlab::Access::AccessDeniedError errors << 'User access was denied' rescue StandardError => e Gitlab::AppLogger.error(e) errors << 'An unknown error occurred' end self end |