FIX: Do not override channel name when category selected (#19920)

This commit is contained in:
Martin Brennan 2023-01-19 18:35:59 +10:00 committed by Bianca Nenciu
parent df30d1fd07
commit 7a074e6684
2 changed files with 12 additions and 1 deletions

View File

@ -149,7 +149,7 @@ export default class CreateChannelController extends Controller.extend(
this.setProperties({
categoryId,
category,
name: category?.name || "",
name: this.name || category?.name || "",
});
}

View File

@ -22,6 +22,16 @@ RSpec.describe "Create channel", type: :system, js: true do
expect(find(".create-channel-hint")).to have_content(Group[:everyone].name)
end
it "does not override channel name if that was already specified" do
visit("/chat")
find(".new-channel-btn").click
fill_in("channel-name", with: "My Cool Channel")
find(".category-chooser").click
find(".category-row[data-value=\"#{category_1.id}\"]").click
expect(page).to have_field("channel-name", with: "My Cool Channel")
end
context "when category is private" do
fab!(:group_1) { Fabricate(:group) }
fab!(:private_category_1) { Fabricate(:private_category, group: group_1) }
@ -95,6 +105,7 @@ RSpec.describe "Create channel", type: :system, js: true do
name = "Cats"
find(".category-chooser").click
find(".category-row[data-value=\"#{category_1.id}\"]").click
expect(page).to have_field("channel-name", with: category_1.name)
fill_in("channel-name", with: name)
fill_in("channel-description", with: "All kind of cute cats")
find(".create-channel-modal .create").click