Class: Projects::GroupLinks::DestroyService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/projects/group_links/destroy_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

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

#can?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#execute(group_link) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/services/projects/group_links/destroy_service.rb', line 6

def execute(group_link)
  return false unless group_link

  if group_link.project.private?
    TodosDestroyer::ProjectPrivateWorker.perform_in(Todo::WAIT_FOR_DELETE, project.id)
  else
    TodosDestroyer::ConfidentialIssueWorker.perform_in(Todo::WAIT_FOR_DELETE, nil, project.id)
  end

  group_link.destroy.tap do |link|
    refresh_project_authorizations_asynchronously(link.project)

    # Until we compare the inconsistency rates of the new specialized worker and
    # the old approach, we still run AuthorizedProjectsWorker
    # but with some delay and lower urgency as a safety net.
    link.group.refresh_members_authorized_projects(
      blocking: false,
      priority: UserProjectAccessChangedService::LOW_PRIORITY
    )
  end
end