2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class GroupDestroyWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2017-08-24 15:24:58 -04:00
|
|
|
include ExceptionBacktrace
|
2016-05-28 22:54:17 -04:00
|
|
|
|
2020-01-09 07:08:03 -05:00
|
|
|
feature_category :subgroups
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2016-05-28 22:54:17 -04:00
|
|
|
def perform(group_id, user_id)
|
|
|
|
begin
|
2018-01-02 11:21:28 -05:00
|
|
|
group = Group.find(group_id)
|
2016-05-28 22:54:17 -04:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
user = User.find(user_id)
|
|
|
|
|
2016-08-13 08:45:31 -04:00
|
|
|
Groups::DestroyService.new(group, user).execute
|
2016-05-28 22:54:17 -04:00
|
|
|
end
|
|
|
|
end
|