spec fixes

This commit is contained in:
Joffrey JAFFEUX
2023-11-08 19:32:24 +01:00
parent 47d503dbf6
commit e4be0eee70
2 changed files with 10 additions and 16 deletions

View File

@ -84,6 +84,10 @@ export default {
return htmlSafe(emojiUnescape(this.channel.escapedTitle)); return htmlSafe(emojiUnescape(this.channel.escapedTitle));
} }
get prefixType() {
return "icon";
}
get prefixValue() { get prefixValue() {
return "d-chat"; return "d-chat";
} }
@ -102,18 +106,6 @@ export default {
return this.channel.chatable.read_restricted ? "lock" : ""; 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() { get suffixType() {
return "icon"; return "icon";
} }
@ -304,7 +296,6 @@ export default {
get prefixCSSClass() { get prefixCSSClass() {
const activeUsers = this.chatService.presenceChannel.users; const activeUsers = this.chatService.presenceChannel.users;
console.log(this.channel.chatable);
const user = getFirstUser( const user = getFirstUser(
this.channel.chatable.users, this.channel.chatable.users,
this.currentUser this.currentUser

View File

@ -159,6 +159,8 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
context "as staff" do context "as staff" do
fab!(:current_user) { Fabricate(:admin) } fab!(:current_user) { Fabricate(:admin) }
before { channel_1.add(current_user) }
it "can edit name" do it "can edit name" do
chat_page.visit_channel_settings(channel_1) 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) edit_modal.fill_and_save_name(name)
expect(channel_settings_page).to have_name(name) expect(page).to have_content(name)
end end
it "can edit description" do it "can edit description" do
@ -191,6 +193,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
it "can edit slug" do it "can edit slug" do
chat_page.visit_channel_settings(channel_1) chat_page.visit_channel_settings(channel_1)
edit_modal = channel_settings_page.open_edit_modal edit_modal = channel_settings_page.open_edit_modal
slug = "gonzo-slug" slug = "gonzo-slug"
@ -199,7 +202,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
edit_modal.fill_and_save_slug(slug) 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 end
it "can clear the slug to use the autogenerated version based on the name" do 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.wait_for_auto_generated_slug
edit_modal.save_changes 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 end
it "shows settings page" do it "shows settings page" do