bootstrap_timeline_service.rb 606 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. class BootstrapTimelineService < BaseService
  3. def call(source_account)
  4. @source_account = source_account
  5. autofollow_inviter!
  6. notify_staff!
  7. end
  8. private
  9. def autofollow_inviter!
  10. return unless @source_account&.user&.invite&.autofollow?
  11. FollowService.new.call(@source_account, @source_account.user.invite.user.account)
  12. end
  13. def notify_staff!
  14. User.those_who_can(:manage_users).includes(:account).find_each do |user|
  15. LocalNotificationWorker.perform_async(user.account_id, @source_account.id, 'Account', 'admin.sign_up')
  16. end
  17. end
  18. end