From b1cff6de6a4f898ed757ba04fd4dd30a2ba3f392 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 14 Nov 2023 11:34:54 +0100 Subject: [PATCH] UX: shows editing title only on settings page (#24330) --- .../components/chat-channel-settings.gjs | 16 ++++++++++- .../components/chat-full-page-header.gjs | 27 ------------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings.gjs index c7af8b917fe..e102defdc54 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings.gjs @@ -66,7 +66,21 @@ export default class ChatAboutScreen extends Component { ); get canEditChannel() { - return this.chatGuardian.canEditChatChannel(); + if ( + this.args.channel.isCategoryChannel && + this.chatGuardian.canEditChatChannel() + ) { + return true; + } + + if ( + this.args.channel.isDirectMessageChannel && + this.args.channel.chatable.group + ) { + return true; + } + + return false; } get shouldRenderDescriptionSection() { diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-full-page-header.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-full-page-header.gjs index c502c71c055..9e7180c643f 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-full-page-header.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-full-page-header.gjs @@ -13,7 +13,6 @@ import ChatChannelStatus from "discourse/plugins/chat/discourse/components/chat- import ChatChannelTitle from "discourse/plugins/chat/discourse/components/chat-channel-title"; export default class ChatFullPageHeader extends Component { - @service chatGuardian; @service chatStateManager; @service modal; @service router; @@ -32,24 +31,6 @@ export default class ChatFullPageHeader extends Component { ); } - get canEditChannel() { - if ( - this.args.channel.isCategoryChannel && - this.chatGuardian.canEditChatChannel() - ) { - return true; - } - - if ( - this.args.channel.isDirectMessageChannel && - this.args.channel.chatable.group - ) { - return true; - } - - return false; - } - @action editChannelTitle() { return this.modal.show(ChatModalEditChannelName, { @@ -85,14 +66,6 @@ export default class ChatFullPageHeader extends Component { - {{#if this.canEditChannel}} - - {{/if}} - {{#if (or @channel.threadingEnabled this.site.desktopView)}}
{{#if this.site.desktopView}}