Skip to content

Commit ed6ffa5

Browse files
author
Vova Maksimchuk
authored
Add options to truncation (#60)
1 parent 9f8ed8e commit ed6ffa5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/stream-chat/channel.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def delete
9595
@client.delete(url)
9696
end
9797

98-
def truncate
99-
@client.post("#{url}/truncate")
98+
def truncate(**options)
99+
@client.post("#{url}/truncate", data: options)
100100
end
101101

102102
def add_members(user_ids)

spec/channel_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@
8282
expect(response).to include 'channel'
8383
end
8484

85+
it 'can truncate with message' do
86+
text = SecureRandom.uuid.to_s
87+
response = @channel.truncate(message: { text: text, user_id: @random_user[:id] })
88+
expect(response).to include 'message'
89+
expect(response['message']['text']).to eq(text)
90+
end
91+
8592
it 'can add members' do
8693
response = @channel.remove_members([@random_user[:id]])
8794
expect(response['members'].length).to eq 0

0 commit comments

Comments
 (0)