You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
523 B

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. # frozen_string_literal: true
  2. module ApplicationCable
  3. class Channel < ActionCable::Channel::Base
  4. protected
  5. def hydrate_status(encoded_message)
  6. message = Oj.load(encoded_message)
  7. return [nil, message] if message['event'] == 'delete'
  8. status_json = Oj.load(message['payload'])
  9. status = Status.find(status_json['id'])
  10. [status, message]
  11. end
  12. def filter?(status)
  13. !status.nil? && FeedManager.instance.filter?(:public, status, current_user.account)
  14. end
  15. end
  16. end