Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't show settings for unfollowed channels (#38135)

Jarek Radosz5df8edfe17da
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs
index 3098900f621..0ada93d45d5 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs
@@ -124,12 +124,18 @@ export default class ChatRouteChannelInfoSettings extends Component {
return this.args.channel.currentUserMembership.muted;
}
+ get shouldRenderMuteSection() {
+ return this.args.channel.currentUserMembership.following;
+ }
+
get shouldRenderChannelWideMentionsAvailable() {
return this.args.channel.isCategoryChannel;
}
get shouldRenderNotificationsLevelSection() {
- return !this.isChannelMuted;
+ return (
+ this.args.channel.currentUserMembership.following && !this.isChannelMuted
+ );
}
get autoJoinAvailable() {
@@ -140,6 +146,15 @@ export default class ChatRouteChannelInfoSettings extends Component {
);
}
+ get shouldRenderSettingsSection() {
+ return (
+ this.args.channel.isOpen &&
+ (this.shouldRenderMuteSection ||
+ this.shouldRenderNotificationsLevelSection ||
+ this.toggleThreadingDirectMessage)
+ );
+ }
+
get shouldRenderAdminSection() {
return (
this.canEditChannel &&
@@ -403,17 +418,19 @@ export default class ChatRouteChannelInfoSettings extends Component {
</form.section>
{{/if}}
- {{#if @channel.isOpen}}
+ {{#if this.shouldRenderSettingsSection}}
<form.section @title={{this.settingsSectionTitle}} as |section|>
- <section.row @label={{this.muteSectionLabel}}>
- <:action>
- <DToggleSwitch
- @state={{@channel.currentUserMembership.muted}}
- class="c-channel-settings__mute-switch"
- {{on "click" this.onToggleMuted}}
- />
- </:action>
- </section.row>
+ {{#if this.shouldRenderMuteSection}}
+ <section.row @label={{this.muteSectionLabel}}>
+ <:action>
+ <DToggleSwitch
+ @state={{@channel.currentUserMembership.muted}}
+ class="c-channel-settings__mute-switch"
+ {{on "click" this.onToggleMuted}}
+ />
+ </:action>
+ </section.row>
+ {{/if}}
{{#if this.shouldRenderNotificationsLevelSection}}
<section.row @label={{this.notificationsLevelLabel}}>