mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FIX: instantly removes group message when leaving (#25961)
Prior to this fix clicking <kbd>x</kdb> on a channel row would effectively leave the channel on server side, but it wouldn't disappear from the screen before a page refresh.
This commit is contained in:
43
plugins/chat/spec/system/drawer/index_spec.rb
Normal file
43
plugins/chat/spec/system/drawer/index_spec.rb
Normal file
@ -0,0 +1,43 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "Drawer - index", type: :system do
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
|
||||
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
|
||||
|
||||
before do
|
||||
chat_system_bootstrap
|
||||
sign_in(current_user)
|
||||
end
|
||||
|
||||
it "can leave a direct message" do
|
||||
channel = Fabricate(:direct_message_channel, users: [current_user])
|
||||
row = PageObjects::Components::Chat::ChannelRow.new(channel.id)
|
||||
|
||||
drawer_page.visit_index
|
||||
|
||||
expect(row).to exist
|
||||
|
||||
row.leave
|
||||
|
||||
expect(row).to be_non_existent
|
||||
end
|
||||
|
||||
it "can leave a group message" do
|
||||
channel =
|
||||
Fabricate(
|
||||
:direct_message_channel,
|
||||
group: true,
|
||||
users: [current_user, Fabricate(:user), Fabricate(:user)],
|
||||
)
|
||||
row = PageObjects::Components::Chat::ChannelRow.new(channel.id)
|
||||
|
||||
drawer_page.visit_index
|
||||
|
||||
expect(row).to exist
|
||||
|
||||
row.leave
|
||||
|
||||
expect(row).to be_non_existent
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user