mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: accounts for hide_profile_and_presence core user option (#20991)
Chat will now correctly use this core setting and will not show the presence of the user in this case.
This commit is contained in:
32
plugins/chat/spec/system/user_presence.rb
Normal file
32
plugins/chat/spec/system/user_presence.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "User presence", type: :system, js: true do
|
||||
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
|
||||
let(:channel) { PageObjects::Pages::ChatChannel.new }
|
||||
|
||||
before do
|
||||
chat_system_bootstrap
|
||||
channel_1.add(current_user)
|
||||
end
|
||||
|
||||
it "shows presence indicator" do
|
||||
sign_in(current_user)
|
||||
chat.visit_channel(channel_1)
|
||||
channel.send_message("Am I present?")
|
||||
|
||||
expect(page).to have_selector(".chat-user-avatar.is-online")
|
||||
end
|
||||
|
||||
context "when user hides presence" do
|
||||
it "hides the presence indicator" do
|
||||
current_user.user_option.update!(hide_profile_and_presence: true)
|
||||
sign_in(current_user)
|
||||
chat.visit_channel(channel_1)
|
||||
channel.send_message("Am I present?")
|
||||
|
||||
expect(page).to have_no_selector(".chat-user-avatar.is-online")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user