Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions spec/channel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,73 +375,6 @@ def loop_times(times)
expect(msg['message']['restricted_visibility']).to match_array([@random_users[0][:id], @random_users[1][:id]])
end

it 'can update message with restricted visibility' do
# Add users as members before testing restricted visibility
@channel.add_members([@random_users[0][:id], @random_users[1][:id]])

# First send a regular message
msg = @channel.send_message(
{
'text' => 'original message'
},
@random_user[:id]
)

# Update the message with restricted visibility
updated_msg = @client.update_message(
{
'id' => msg['message']['id'],
'text' => 'updated secret message',
'restricted_visibility' => [@random_users[0][:id], @random_users[1][:id]],
'user' => { 'id' => @random_user[:id] }
}
)

# Verify the message was updated successfully
expect(updated_msg).to include 'message'
expect(updated_msg['message']['text']).to eq 'updated secret message'

# Verify the restricted visibility
expect(updated_msg['message']['restricted_visibility']).to match_array([@random_users[0][:id], @random_users[1][:id]])
end

it 'can update message partially with restricted visibility' do
# Add users as members before testing restricted visibility
@channel.add_members([@random_users[0][:id], @random_users[1][:id]])

# First send a regular message
msg = @channel.send_message(
{
'text' => 'original message',
'custom_field' => 'original value'
},
@random_user[:id]
)

# Partially update the message with restricted visibility
updated_msg = @client.update_message_partial(
msg['message']['id'],
{
set: {
text: 'partially updated secret message',
restricted_visibility: [@random_users[0][:id], @random_users[1][:id]]
},
unset: ['custom_field']
},
user_id: @random_user[:id]
)

# Verify the message was updated successfully
expect(updated_msg).to include 'message'
expect(updated_msg['message']['text']).to eq 'partially updated secret message'

# Verify the restricted visibility was set
expect(updated_msg['message']['restricted_visibility']).to match_array([@random_users[0][:id], @random_users[1][:id]])

# Verify the custom field was unset
expect(updated_msg['message']).not_to include 'custom_field'
end

it 'can create draft message' do
draft_message = { 'text' => 'This is a draft message' }
response = @channel.create_draft(draft_message, @random_user[:id])
Expand Down