2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Groups
|
|
|
|
module GroupLinks
|
|
|
|
class DestroyService < BaseService
|
|
|
|
def execute(one_or_more_links)
|
|
|
|
links = Array(one_or_more_links)
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
if GroupGroupLink.delete(links)
|
|
|
|
Gitlab::AppLogger.info(
|
|
|
|
"GroupGroupLinks with ids: #{links.map(&:id)} have been deleted.")
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
groups_to_refresh = links.map(&:shared_with_group)
|
|
|
|
groups_to_refresh.uniq.each do |group|
|
|
|
|
group.refresh_members_authorized_projects
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
else
|
|
|
|
Gitlab::AppLogger.info(
|
|
|
|
"Failed to delete GroupGroupLinks with ids: #{links.map(&:id)}.")
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|