From 9e55d0f5de0c36f7848c1733b5faacee6cdae721 Mon Sep 17 00:00:00 2001 From: javierdfm Date: Fri, 7 Nov 2025 11:50:28 +0100 Subject: [PATCH 1/2] feat: add filter tags support for channels --- lib/stream-chat/channel.rb | 12 ++++++++++++ spec/channel_spec.rb | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/stream-chat/channel.rb b/lib/stream-chat/channel.rb index 19b2ec1..6fe2eb6 100644 --- a/lib/stream-chat/channel.rb +++ b/lib/stream-chat/channel.rb @@ -267,6 +267,18 @@ def add_moderators(user_ids) update(nil, nil, add_moderators: user_ids) end + # Adds filter tags to the channel. + sig { params(tags: T::Array[String]).returns(StreamChat::StreamResponse) } + def add_filter_tags(tags) + update(nil, nil, add_filter_tags: tags) + end + + # Removes filter tags from the channel. + sig { params(tags: T::Array[String]).returns(StreamChat::StreamResponse) } + def remove_filter_tags(tags) + update(nil, nil, remove_filter_tags: tags) + end + # Removes members from the channel. sig { params(user_ids: T::Array[String]).returns(StreamChat::StreamResponse) } def remove_members(user_ids) diff --git a/spec/channel_spec.rb b/spec/channel_spec.rb index 1215c1c..0841557 100644 --- a/spec/channel_spec.rb +++ b/spec/channel_spec.rb @@ -502,4 +502,20 @@ def loop_times(times) # Verify it's deleted expect { @channel.get_draft(@random_user[:id], parent_id: parent_id) }.to raise_error(StreamChat::StreamAPIException) end + + it 'can add and remove filter tags' do + tags = ['urgent', 'bug'] + # Add tags + response = @channel.add_filter_tags(tags) + expect(response).to include 'channel' + + # Ensure tags are set + response = @channel.query + expect(response['channel']['filter_tags']).to match_array(tags) + + # Remove one tag + @channel.remove_filter_tags(['urgent']) + response = @channel.query + expect(response['channel']['filter_tags']).to match_array(['bug']) + end end From 80739608b2adeb73aea64b673ce12ff344078fb1 Mon Sep 17 00:00:00 2001 From: javierdfm Date: Fri, 7 Nov 2025 11:55:12 +0100 Subject: [PATCH 2/2] Updated syntax --- spec/channel_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/channel_spec.rb b/spec/channel_spec.rb index 0841557..fcf751d 100644 --- a/spec/channel_spec.rb +++ b/spec/channel_spec.rb @@ -504,7 +504,7 @@ def loop_times(times) end it 'can add and remove filter tags' do - tags = ['urgent', 'bug'] + tags = %w[urgent bug] # Add tags response = @channel.add_filter_tags(tags) expect(response).to include 'channel'