The code powering m.abunchtell.com https://m.abunchtell.com
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

27 строки
832 B

  1. # frozen_string_literal: true
  2. class PublishScheduledStatusWorker
  3. include Sidekiq::Worker
  4. sidekiq_options unique: :until_executed
  5. def perform(scheduled_status_id)
  6. scheduled_status = ScheduledStatus.find(scheduled_status_id)
  7. scheduled_status.destroy!
  8. PostStatusService.new.call(
  9. scheduled_status.account,
  10. options_with_objects(scheduled_status.params.with_indifferent_access)
  11. )
  12. rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
  13. true
  14. end
  15. def options_with_objects(options)
  16. options.tap do |options_hash|
  17. options_hash[:application] = Doorkeeper::Application.find(options_hash.delete(:application_id)) if options[:application_id]
  18. options_hash[:thread] = Status.find(options_hash.delete(:in_reply_to_id)) if options_hash[:in_reply_to_id]
  19. end
  20. end
  21. end