闭社主体 forked from https://github.com/tootsuite/mastodon
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
619 B

8 years ago
8 years ago
8 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 = ActiveSupport::JSON.decode(encoded_message)
  7. return [nil, message] if message['type'] == 'delete'
  8. status = Status.find_by(id: message['id'])
  9. message['message'] = FeedManager.instance.inline_render(current_user.account, 'api/v1/statuses/show', status)
  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