From 48b9619439818ecb344ae33c9c31a55ecb1aa27a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 5 Nov 2016 15:20:05 +0100 Subject: Adding hashtags --- app/channels/hashtag_channel.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/channels/hashtag_channel.rb (limited to 'app/channels/hashtag_channel.rb') diff --git a/app/channels/hashtag_channel.rb b/app/channels/hashtag_channel.rb new file mode 100644 index 000000000..5be8d94cd --- /dev/null +++ b/app/channels/hashtag_channel.rb @@ -0,0 +1,11 @@ +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 -- cgit