diff --git a/lib/stream-chat/client.rb b/lib/stream-chat/client.rb index 86291ae..1f46789 100644 --- a/lib/stream-chat/client.rb +++ b/lib/stream-chat/client.rb @@ -1058,7 +1058,7 @@ def delete_reminder(message_id, user_id) sig { params(user_id: String, filter_conditions: T::Hash[T.untyped, T.untyped], sort: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]), options: T.untyped).returns(StreamChat::StreamResponse) } def query_reminders(user_id, filter_conditions = {}, sort: nil, **options) params = options.merge({ - filter_conditions: filter_conditions, + filter: filter_conditions, sort: sort || [{ field: 'remind_at', direction: 1 }], user_id: user_id }) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 5dc819d..0592d99 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -1342,9 +1342,25 @@ def loop_times(times) expect(response['reminders']).to be_an(Array) expect(response['reminders'].length).to be >= 1 - # All reminders should have a channel_cid + # All reminders should have a channel_cid that matches the filter response['reminders'].each do |reminder| expect(reminder).to include('channel_cid') + expect(reminder['channel_cid']).to eq(@channel.cid) + end + end + + it 'query reminders with message_id filter' do + # Query reminders for a specific message + filter = { 'message_id' => @message_id } + response = @client.query_reminders(@user_id, filter) + + expect(response).to include('reminders') + expect(response['reminders']).to be_an(Array) + expect(response['reminders'].length).to be >= 1 + + # All reminders should have the filtered message_id + response['reminders'].each do |reminder| + expect(reminder['message_id']).to eq(@message_id) end end end