Class: WorkItems::RelatedWorkItemLinks::CreateService
- Inherits:
-
IssuableLinks::CreateService
- Object
- BaseService
- IssuableLinks::CreateService
- WorkItems::RelatedWorkItemLinks::CreateService
- Extended by:
- Gitlab::Utils::Override
- Defined in:
- app/services/work_items/related_work_item_links/create_service.rb
Instance Attribute Summary
Attributes inherited from IssuableLinks::CreateService
#current_user, #issuable, #new_links, #params
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods included from Gitlab::Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods inherited from IssuableLinks::CreateService
#initialize, #relate_issuables
Methods inherited from BaseService
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
This class inherits a constructor from IssuableLinks::CreateService
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/work_items/related_work_item_links/create_service.rb', line 8 def execute return error(_('No matching work item found.'), 404) unless can_admin_work_item_link?(issuable) response = super after_execute if response[:status] == :success response[:message] = format( _('Successfully linked ID(s): %{item_ids}.'), item_ids: linked_ids(response[:created_references]).to_sentence ) end response end |
#linkable_issuables(work_items) ⇒ Object
24 25 26 |
# File 'app/services/work_items/related_work_item_links/create_service.rb', line 24 def linkable_issuables(work_items) @linkable_issuables ||= work_items.select { |work_item| can_link_item?(work_item) } end |
#previous_related_issuables ⇒ Object
28 29 30 |
# File 'app/services/work_items/related_work_item_links/create_service.rb', line 28 def @related_issues ||= issuable.linked_work_items(authorize: false).to_a end |