From e4be0eee7072941aba0df8a8f16ec6bb80397cc0 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 8 Nov 2023 19:32:24 +0100 Subject: [PATCH] spec fixes --- .../discourse/initializers/chat-sidebar.js | 17 ++++------------- .../spec/system/channel_settings_page_spec.rb | 9 ++++++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js index eb9327ede1c..2d66a131a47 100644 --- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js +++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js @@ -84,6 +84,10 @@ export default { return htmlSafe(emojiUnescape(this.channel.escapedTitle)); } + get prefixType() { + return "icon"; + } + get prefixValue() { return "d-chat"; } @@ -102,18 +106,6 @@ export default { return this.channel.chatable.read_restricted ? "lock" : ""; } - get prefixCSSClass() { - const activeUsers = this.chatService.presenceChannel.users; - const user = this.channel.chatable.users[0]; - if ( - !!activeUsers?.findBy("id", user?.id) || - !!activeUsers?.findBy("username", user?.username) - ) { - return "active"; - } - return ""; - } - get suffixType() { return "icon"; } @@ -304,7 +296,6 @@ export default { get prefixCSSClass() { const activeUsers = this.chatService.presenceChannel.users; - console.log(this.channel.chatable); const user = getFirstUser( this.channel.chatable.users, this.currentUser diff --git a/plugins/chat/spec/system/channel_settings_page_spec.rb b/plugins/chat/spec/system/channel_settings_page_spec.rb index 1e6631d69b9..b81907dfdbf 100644 --- a/plugins/chat/spec/system/channel_settings_page_spec.rb +++ b/plugins/chat/spec/system/channel_settings_page_spec.rb @@ -159,6 +159,8 @@ RSpec.describe "Channel - Info - Settings page", type: :system do context "as staff" do fab!(:current_user) { Fabricate(:admin) } + before { channel_1.add(current_user) } + it "can edit name" do chat_page.visit_channel_settings(channel_1) @@ -170,7 +172,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do edit_modal.fill_and_save_name(name) - expect(channel_settings_page).to have_name(name) + expect(page).to have_content(name) end it "can edit description" do @@ -191,6 +193,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do it "can edit slug" do chat_page.visit_channel_settings(channel_1) + edit_modal = channel_settings_page.open_edit_modal slug = "gonzo-slug" @@ -199,7 +202,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do edit_modal.fill_and_save_slug(slug) - expect(channel_settings_page).to have_slug(slug) + expect(page).to have_current_path("/chat/c/gonzo-slug/#{channel_1.id}") end it "can clear the slug to use the autogenerated version based on the name" do @@ -213,7 +216,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do edit_modal.wait_for_auto_generated_slug edit_modal.save_changes - expect(channel_settings_page).to have_slug("test-channel") + expect(page).to have_current_path("/chat/c/test-channel/#{channel_1.id}") end it "shows settings page" do