Skip to content

Commit 70eee3b

Browse files
author
Rafael Marinho
committed
fix
1 parent 417d6f3 commit 70eee3b

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

lib/stream-chat/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,8 @@ def query_reminders(user_id, filter_conditions = {}, sort: nil, **options)
10701070
# @param [StringKeyHash, nil] data The delivery confirmation data
10711071
# @return [StreamChat::StreamResponse] API response
10721072
sig { params(data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
1073-
def mark_channels_delivered(data = nil)
1074-
post('channels/delivered', data: data || {})
1073+
def mark_delivered(data = nil, user_id: nil)
1074+
post('channels/delivered', data: data || {}, params: { user_id: user_id })
10751075
end
10761076

10771077
private

spec/client_spec.rb

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,37 +1436,27 @@ def loop_times(times)
14361436
end
14371437
end
14381438

1439-
describe '#mark_channels_delivered' do
1440-
it 'should mark channels as delivered' do
1439+
describe '#mark_delivered' do
1440+
it 'should mark messages as delivered' do
14411441
# Create some test messages first
1442-
message1 = @channel.send_message({ text: 'Test message 1' }, @frodo)
1443-
message2 = @channel.send_message({ text: 'Test message 2' }, @sam)
1442+
message = @channel.send_message({ text: 'Test message 1' }, @frodo)
14441443

14451444
# Create delivery confirmation data
14461445
delivery_data = {
14471446
latest_delivered_messages: [
14481447
{
14491448
cid: @channel.cid,
1450-
id: message1['message']['id']
1451-
},
1452-
{
1453-
cid: @channel.cid,
1454-
id: message2['message']['id']
1449+
id: message['message']['id']
14551450
}
14561451
],
14571452
user_id: @gandalf
14581453
}
14591454

14601455
# Call the method
1461-
response = @client.mark_channels_delivered(delivery_data)
1456+
response = @client.mark_delivered(delivery_data, user_id: @gandalf)
14621457

14631458
# The response should be successful (status 200)
14641459
expect(response.status_code).to eq(200)
14651460
end
1466-
1467-
it 'should handle empty data' do
1468-
response = @client.mark_channels_delivered
1469-
expect(response.status_code).to eq(200)
1470-
end
14711461
end
14721462
end

0 commit comments

Comments
 (0)