diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs index 29707eb7573..05ebec3b06e 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs @@ -18,22 +18,22 @@
-
+
{{replace-emoji this.channel.escapedTitle}}
@@ -90,4 +90,4 @@ leaveIcon="sign-out-alt" }} /> -
\ No newline at end of file +
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.js index 0537ff51bd2..c7e1aa5b65a 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.js @@ -5,7 +5,7 @@ export default class ChatChannelAboutView extends Component { @service chat; tagName = ""; channel = null; - onEditChatChannelTitle = null; + onEditChatChannelName = null; onEditChatChannelDescription = null; isLoading = false; } diff --git a/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-title.js b/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-name.js similarity index 68% rename from plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-title.js rename to plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-name.js index d57ad3f6ce6..fcba0d77118 100644 --- a/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-title.js +++ b/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-edit-name.js @@ -6,30 +6,30 @@ export default class ChatChannelEditTitleController extends Controller.extend( ModalFunctionality ) { @service chatApi; - editedTitle = ""; + editedName = ""; - @computed("model.title", "editedTitle") + @computed("model.title", "editedName") get isSaveDisabled() { return ( - this.model.title === this.editedTitle || - this.editedTitle?.length > this.siteSettings.max_topic_title_length + this.model.title === this.editedName || + this.editedName?.length > this.siteSettings.max_topic_title_length ); } onShow() { - this.set("editedTitle", this.model.title || ""); + this.set("editedName", this.model.title || ""); } onClose() { - this.set("editedTitle", ""); + this.set("editedName", ""); this.clearFlash(); } @action - onSaveChatChannelTitle() { + onSaveChatChannelName() { return this.chatApi .updateChannel(this.model.id, { - name: this.editedTitle, + name: this.editedName, }) .then((result) => { this.model.set("title", result.channel.title); @@ -43,8 +43,8 @@ export default class ChatChannelEditTitleController extends Controller.extend( } @action - onChangeChatChannelTitle(title) { + onChangeChatChannelName(title) { this.clearFlash(); - this.set("editedTitle", title); + this.set("editedName", title); } } diff --git a/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-info-about.js b/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-info-about.js index d33ec8fd222..73514a7bd6d 100644 --- a/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-info-about.js +++ b/plugins/chat/assets/javascripts/discourse/controllers/chat-channel-info-about.js @@ -7,8 +7,8 @@ export default class ChatChannelInfoAboutController extends Controller.extend( ModalFunctionality ) { @action - onEditChatChannelTitle() { - showModal("chat-channel-edit-title", { model: this.model }); + onEditChatChannelName() { + showModal("chat-channel-edit-name", { model: this.model }); } @action diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs index 5f5d5a8aa1e..e7c3b8d6a47 100644 --- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs +++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs @@ -1,5 +1,5 @@ \ No newline at end of file +/> diff --git a/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs b/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs new file mode 100644 index 00000000000..00492a25217 --- /dev/null +++ b/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs @@ -0,0 +1,22 @@ + + + + {{i18n "chat.channel_edit_name_modal.description"}} + + + + diff --git a/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-title.hbs b/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-title.hbs deleted file mode 100644 index 99fb42dcbc8..00000000000 --- a/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-title.hbs +++ /dev/null @@ -1,20 +0,0 @@ - - - - {{i18n "chat.channel_edit_title_modal.description"}} - - - - \ No newline at end of file diff --git a/plugins/chat/assets/stylesheets/common/chat-channel-info.scss b/plugins/chat/assets/stylesheets/common/chat-channel-info.scss index 29f3cb30cda..091ea9366d8 100644 --- a/plugins/chat/assets/stylesheets/common/chat-channel-info.scss +++ b/plugins/chat/assets/stylesheets/common/chat-channel-info.scss @@ -117,13 +117,14 @@ input.channel-members-view__search-input { } } -// Channel info edit title modal -.chat-channel-edit-title-modal__title-input { +// Channel info edit name modal +.chat-channel-edit-name-modal__name-input { display: flex; margin: 0; + width: 100%; } -.chat-channel-edit-title-modal__description { +.chat-channel-edit-name-modal__description { display: flex; padding: 0.5rem 0; color: var(--primary-medium); diff --git a/plugins/chat/config/locales/client.en.yml b/plugins/chat/config/locales/client.en.yml index e7761687bc6..58e3b4d7aee 100644 --- a/plugins/chat/config/locales/client.en.yml +++ b/plugins/chat/config/locales/client.en.yml @@ -233,6 +233,7 @@ en: associated_topic: Linked topic associated_category: Linked category title: Title + name: Name description: Description channel_info: @@ -243,10 +244,10 @@ en: members: Members settings: Settings - channel_edit_title_modal: - title: Edit title - input_placeholder: Add a title - description: Give a short descriptive title to your channel + channel_edit_name_modal: + title: Edit name + input_placeholder: Add a name + description: Give a short descriptive name to your channel channel_edit_description_modal: title: Edit description diff --git a/plugins/chat/spec/system/channel_about_page_spec.rb b/plugins/chat/spec/system/channel_about_page_spec.rb index a1cd22bd851..192ddd94b6b 100644 --- a/plugins/chat/spec/system/channel_about_page_spec.rb +++ b/plugins/chat/spec/system/channel_about_page_spec.rb @@ -16,14 +16,14 @@ RSpec.describe "Channel - Info - About page", type: :system, js: true do chat_page.visit_channel_about(channel_1) expect(page.find(".category-name")).to have_content(channel_1.chatable.name) - expect(page.find(".channel-info-about-view__title")).to have_content(channel_1.title) + expect(page.find(".channel-info-about-view__name")).to have_content(channel_1.title) end it "escapes channel title" do channel_1.update!(name: "") chat_page.visit_channel_about(channel_1) - expect(page.find(".channel-info-about-view__title")["innerHTML"].strip).to eq( + expect(page.find(".channel-info-about-view__name")["innerHTML"].strip).to eq( "<script>alert('hello')</script>", ) expect(page.find(".chat-channel-title__name")["innerHTML"].strip).to eq( @@ -31,10 +31,10 @@ RSpec.describe "Channel - Info - About page", type: :system, js: true do ) end - it "can’t edit title" do + it "can’t edit name" do chat_page.visit_channel_about(channel_1) - expect(page).to have_no_selector(".edit-title-btn") + expect(page).to have_no_selector(".edit-name-btn") end it "can’t edit description" do @@ -76,20 +76,17 @@ RSpec.describe "Channel - Info - About page", type: :system, js: true do before { sign_in(current_user) } - it "can edit title" do + it "can edit name" do chat_page.visit_channel_about(channel_1) - find(".edit-title-btn").click + find(".edit-name-btn").click - expect(page).to have_selector( - ".chat-channel-edit-title-modal__title-input", - text: channel_1.title, - ) + expect(find(".chat-channel-edit-name-modal__name-input").value).to eq(channel_1.title) - title = "A new title" - find(".chat-channel-edit-title-modal__title-input").fill_in(with: title) + name = "A new name" + find(".chat-channel-edit-name-modal__name-input").fill_in(with: name) find(".create").click - expect(page).to have_content(title) + expect(page).to have_content(name) end it "can edit description" do