about summary refs log tree commit diff
path: root/app/channels/hashtag_channel.rb
blob: 4470a0e990bb1692c250ec478b3c9c363b4bdc87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class HashtagChannel < ApplicationCable::Channel
  def subscribed
    tag = params[:tag].downcase

    stream_from "timeline:hashtag:#{tag}", lambda { |encoded_message|
      status, message = hydrate_status(encoded_message)
      next if filter?(status)
      transmit message
    }
  end
end