2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Projects
|
|
|
|
module GroupLinks
|
|
|
|
class DestroyService < BaseService
|
|
|
|
def execute(group_link)
|
|
|
|
return false unless group_link
|
|
|
|
|
2020-02-01 01:16:34 +05:30
|
|
|
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
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
group_link.destroy.tap do |link|
|
2021-11-11 11:23:49 +05:30
|
|
|
refresh_project_authorizations_asynchronously(link.project)
|
2021-09-04 01:27:46 +05:30
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
# 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(
|
|
|
|
priority: UserProjectAccessChangedService::LOW_PRIORITY
|
|
|
|
)
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def refresh_project_authorizations_asynchronously(project)
|
|
|
|
AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
Projects::GroupLinks::DestroyService.prepend_mod_with('Projects::GroupLinks::DestroyService')
|