2018-08-02 14:16:58 +00:00
|
|
|
module Todos
|
|
|
|
module Destroy
|
|
|
|
class GroupPrivateService < ::Todos::Destroy::BaseService
|
|
|
|
extend ::Gitlab::Utils::Override
|
|
|
|
|
|
|
|
attr_reader :group
|
|
|
|
|
|
|
|
def initialize(group_id)
|
|
|
|
@group = Group.find_by(id: group_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
override :todos
|
|
|
|
def todos
|
|
|
|
Todo.where(group_id: group.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
override :authorized_users
|
|
|
|
def authorized_users
|
2018-08-06 08:42:51 +00:00
|
|
|
group.direct_and_indirect_users.select(:id)
|
2018-08-02 14:16:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
override :todos_to_remove?
|
|
|
|
def todos_to_remove?
|
|
|
|
group&.private?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|