UX: shows editing title only on settings page (#24330)

This commit is contained in:
Joffrey JAFFEUX 2023-11-14 11:34:54 +01:00 committed by GitHub
parent 2b4251c56c
commit b1cff6de6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 28 deletions

View File

@ -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() {

View File

@ -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 {
<ChatChannelTitle @channel={{@channel}} />
</LinkTo>
{{#if this.canEditChannel}}
<DButton
@icon="pencil-alt"
class="btn-flat"
@action={{this.editChannelTitle}}
/>
{{/if}}
{{#if (or @channel.threadingEnabled this.site.desktopView)}}
<div class="chat-full-page-header__right-actions">
{{#if this.site.desktopView}}