Skip to content

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

DEV: Remove dependance on setting for starred channels (#36543)

Keegan George7f796674b011
diff --git a/plugins/chat/app/serializers/chat/base_channel_membership_serializer.rb b/plugins/chat/app/serializers/chat/base_channel_membership_serializer.rb
index 44dd45882ed..586b1570900 100644
--- a/plugins/chat/app/serializers/chat/base_channel_membership_serializer.rb
+++ b/plugins/chat/app/serializers/chat/base_channel_membership_serializer.rb
@@ -11,11 +11,7 @@ module Chat
:starred
def starred
- if scope.user&.upcoming_change_enabled?(:star_chat_channels)
- object.starred
- else
- false
- end
+ object.starred
end
def include_starred?
diff --git a/plugins/chat/app/services/chat/update_user_channel_membership.rb b/plugins/chat/app/services/chat/update_user_channel_membership.rb
index db5e85a0a54..fa9e412d446 100644
--- a/plugins/chat/app/services/chat/update_user_channel_membership.rb
+++ b/plugins/chat/app/services/chat/update_user_channel_membership.rb
@@ -33,7 +33,6 @@ module Chat
model :channel
model :membership
policy :can_access_channel
- policy :can_use_starred_channels
transaction { step :update_membership }
private
@@ -50,10 +49,6 @@ module Chat
guardian.can_preview_chat_channel?(membership.chat_channel)
end
- def can_use_starred_channels(guardian:)
- guardian.user.upcoming_change_enabled?(:star_chat_channels)
- end
-
def update_membership(membership:, params:)
membership.update!(starred: params.starred)
end
diff --git a/plugins/chat/assets/javascripts/discourse/components/channels-list-direct.gjs b/plugins/chat/assets/javascripts/discourse/components/channels-list-direct.gjs
index f093d12797e..02598eea532 100644
--- a/plugins/chat/assets/javascripts/discourse/components/channels-list-direct.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/channels-list-direct.gjs
@@ -20,7 +20,6 @@ export default class ChannelsListDirect extends Component {
@service chatChannelsManager;
@service site;
@service modal;
- @service siteSettings;
get inSidebar() {
return this.args.inSidebar ?? false;
@@ -49,7 +48,7 @@ export default class ChannelsListDirect extends Component {
}
get channelList() {
- if (!this.inSidebar && this.siteSettings.star_chat_channels) {
+ if (!this.inSidebar) {
return this.chatChannelsManager.truncatedUnstarredDirectMessageChannels;
}
return this.chatChannelsManager.truncatedDirectMessageChannels;
diff --git a/plugins/chat/assets/javascripts/discourse/components/channels-list-public.gjs b/plugins/chat/assets/javascripts/discourse/components/channels-list-public.gjs
index 173d66afb74..b7bbf0ec4e8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/channels-list-public.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/channels-list-public.gjs
@@ -19,7 +19,6 @@ export default class ChannelsListPublic extends Component {
@service chatTrackingStateManager;
@service site;
@service router;
- @service siteSettings;
get inSidebar() {
return this.args.inSidebar ?? false;
@@ -34,7 +33,7 @@ export default class ChannelsListPublic extends Component {
}
get channelList() {
- if (!this.inSidebar && this.siteSettings.star_chat_channels) {
+ if (!this.inSidebar) {
return this.chatChannelsManager.unstarredPublicMessageChannelsByActivity;
}
return this.chatChannelsManager.publicMessageChannelsByActivity;
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs
index bb2a316b430..407b4527552 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-footer.gjs
@@ -20,10 +20,7 @@ export default class ChatFooter extends Component {
@service chatStateManager;
get includeStarred() {
- return (
- this.siteSettings.star_chat_channels &&
- this.chatChannelsManager.hasStarredChannels
- );
+ return this.chatChannelsManager.hasStarredChannels;
}
get includeThreads() {
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/footer/unread-indicator.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/footer/unread-indicator.gjs
index 38b042aedd2..8c857e052b7 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/footer/unread-indicator.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/footer/unread-indicator.gjs
@@ -26,7 +26,6 @@ export const UnreadThreadsIndicator = <template>
export default class FooterUnreadIndicator extends Component {
@service chatChannelsManager;
@service chatTrackingStateManager;
- @service siteSettings;
badgeType = this.args.badgeType;
@@ -57,9 +56,6 @@ export default class FooterUnreadIndicator extends Component {
}
get unstarredPublicChannelMentionCount() {
- if (!this.siteSettings.star_chat_channels) {
- return this.chatTrackingStateManager.publicChannelMentionCount;
- }
return this.chatChannelsManager.unstarredPublicMessageChannels.reduce(
(count, channel) => count + channel.tracking.mentionCount,
0
@@ -67,9 +63,6 @@ export default class FooterUnreadIndicator extends Component {
}
get unstarredPublicChannelUnreadCount() {
- if (!this.siteSettings.star_chat_channels) {
- return this.chatTrackingStateManager.publicChannelUnreadCount;
- }
return this.chatChannelsManager.unstarredPublicMessageChannels.reduce(
(count, channel) => count + channel.tracking.unreadCount,
0
@@ -77,12 +70,6 @@ export default class FooterUnreadIndicator extends Component {
}
get unstarredDMUrgentCount() {
- if (!this.siteSettings.star_chat_channels) {
- return (
- this.chatTrackingStateManager.directMessageUnreadCount +
- this.chatTrackingStateManager.directMessageMentionCount
- );
- }
return this.chatChannelsManager.unstarredDirectMessageChannels.reduce(
(count, channel) =>
count + channel.tracking.unreadCount + channel.tracking.mentionCount,
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/channel-title.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/channel-title.gjs
index ad99cb79818..717d48bb1f2 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/channel-title.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/channel-title.gjs
@@ -12,7 +12,6 @@ import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-ti
export default class ChatNavbarChannelTitle extends Component {
@service chatApi;
@service chatStateManager;
- @service siteSettings;
@tracked isTogglingStarred = false;
@@ -38,10 +37,7 @@ export default class ChatNavbarChannelTitle extends Component {
}
get showStarButton() {
- return (
- this.args.channel?.currentUserMembership &&
- this.siteSettings.star_chat_channels
- );
+ return !!this.args.channel?.currentUserMembership;
}
@action
diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
index a28bde7a5f1..f83d42caabb 100644
--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
@@ -388,76 +388,74 @@ export default {
CHAT_PANEL
);
- if (this.siteSettings.star_chat_channels) {
- api.addSidebarSection(
- (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {
- const SidebarChatStarredChannelLink = createChannelLink(
- BaseCustomSidebarSectionLink,
- {
- showSuffix: false,
- enableHoverForPublicChannels: false,
- }
- );
+ api.addSidebarSection(
+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {
+ const SidebarChatStarredChannelLink = createChannelLink(
+ BaseCustomSidebarSectionLink,
+ {
+ showSuffix: false,
+ enableHoverForPublicChannels: false,
+ }
+ );
- const SidebarChatStarredChannelsSection = class extends BaseCustomSidebarSection {
- @service currentUser;
- @service chatStateManager;
- @service siteSettings;
+ const SidebarChatStarredChannelsSection = class extends BaseCustomSidebarSection {
+ @service currentUser;
+ @service chatStateManager;
+ @service siteSettings;
- constructor() {
- super(...arguments);
+ constructor() {
+ super(...arguments);
- if (container.isDestroyed) {
- return;
- }
- this.chatService = container.lookup("service:chat");
- this.chatChannelsManager = container.lookup(
- "service:chat-channels-manager"
- );
+ if (container.isDestroyed) {
+ return;
}
+ this.chatService = container.lookup("service:chat");
+ this.chatChannelsManager = container.lookup(
+ "service:chat-channels-manager"
+ );
+ }
- get sectionLinks() {
- return this.chatChannelsManager.starredChannels.map(
- (channel) =>
- new SidebarChatStarredChannelLink({
- channel,
- chatService: this.chatService,
- currentUser: this.currentUser,
- siteSettings: this.siteSettings,
- chatStateManager: this.chatStateManager,
- })
- );
- }
+ get sectionLinks() {
+ return this.chatChannelsManager.starredChannels.map(
+ (channel) =>
+ new SidebarChatStarredChannelLink({
+ channel,
+ chatService: this.chatService,
+ currentUser: this.currentUser,
+ siteSettings: this.siteSettings,
+ chatStateManager: this.chatStateManager,
+ })
+ );
+ }
- get name() {
- return CHAT_STARRED_CHANNELS_SECTION;
- }
+ get name() {
+ return CHAT_STARRED_CHANNELS_SECTION;
+ }
- get title() {
- return i18n("chat.starred_channels");
- }
+ get title() {
+ return i18n("chat.starred_channels");
+ }
- get text() {
- return i18n("chat.starred_channels");
- }
+ get text() {
+ return i18n("chat.starred_channels");
+ }
- get links() {
- return this.sectionLinks;
- }
+ get links() {
+ return this.sectionLinks;
+ }
- get displaySection() {
- return (
- this.chatStateManager.hasPreloadedChannels &&
- this.chatChannelsManager.hasStarredChannels
- );
- }
- };
+ get displaySection() {
+ return (
+ this.chatStateManager.hasPreloadedChannels &&
+ this.chatChannelsManager.hasStarredChannels
+ );
+ }
+ };
- return SidebarChatStarredChannelsSection;
- },
- CHAT_PANEL
- );
- }
+ return SidebarChatStarredChannelsSection;
+ },
+ CHAT_PANEL
+ );
if (this.siteSettings.enable_public_channels) {
api.addSidebarSection(
@@ -575,11 +573,7 @@ export default {
}
get sectionLinks() {
- const channels = this.siteSettings.star_chat_channels
- ? this.chatChannelsManager.unstarredPublicMessageChannels
- : this.chatChannelsManager.publicMessageChannels;
-
- return channels.map(
+ return this.chatChannelsManager.unstarredPublicMessageChannels.map(
(channel) =>
new SidebarChatChannelsSectionLink({
channel,
@@ -828,19 +822,16 @@ export default {
}
get hideSectionHeader() {
- const channels = this.siteSettings.star_chat_channels
- ? this.chatChannelsManager
- .truncatedUnstarredDirectMessageChannels
- : this.chatChannelsManager.truncatedDirectMessageChannels;
-
- return channels.length === 0;
+ return (
+ this.chatChannelsManager
+ .truncatedUnstarredDirectMessageChannels.length === 0
+ );
}
get sectionLinks() {
- const channels = this.siteSettings.star_chat_channels
- ? this.chatChannelsManager
- .truncatedUnstarredDirectMessageChannels
- : this.chatChannelsManager.truncatedDirectMessageChannels;
+ const channels =
+ this.chatChannelsManager
+ .truncatedUnstarredDirectMessageChannels;
if (channels.length > 0) {
return channels.map(
diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js b/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js
index 6162b75ce66..c37017838b8 100644
--- a/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js
+++ b/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js
@@ -187,10 +187,6 @@ export default class ChatChannelsManager extends Service {
* @returns {ChatChannel[]} Array of unstarred public channels sorted by activity
*/
get unstarredPublicMessageChannelsByActivity() {
- if (!this.siteSettings.star_chat_channels) {
- return this.publicMessageChannelsByActivity;
- }
-
return this.#sortChannelsByActivity(
this.channels.filter(
(channel) =>
@@ -226,10 +222,6 @@ export default class ChatChannelsManager extends Service {
* @returns {ChatChannel[]} Array of starred channels
*/
get starredChannels() {
- if (!this.siteSettings.star_chat_channels) {
- return [];
- }
-
const starredPublic = this.channels
.filter(
(channel) =>
@@ -268,10 +260,6 @@ export default class ChatChannelsManager extends Service {
* @returns {ChatChannel[]} Array of starred channels sorted by activity
*/
get starredChannelsByActivity() {
- if (!this.siteSettings.star_chat_channels) {
- return [];
- }
-
const starredChannels = this.channels.filter(
(channel) =>
channel.currentUserMembership?.following &&
@@ -347,10 +335,6 @@ export default class ChatChannelsManager extends Service {
* @returns {ChatChannel[]} Array of unstarred public channels
*/
get unstarredPublicMessageChannels() {
- if (!this.siteSettings.star_chat_channels) {
- return this.publicMessageChannels;
- }
-
return this.#sortChannelsByProperty(
this.channels.filter(
(channel) =>
@@ -370,10 +354,6 @@ export default class ChatChannelsManager extends Service {
* @returns {ChatChannel[]} Array of unstarred DM channels
*/
get unstarredDirectMessageChannels() {
- if (!this.siteSettings.star_chat_channels) {
- return this.directMessageChannels;
- }
-
return this.#sortDirectMessageChannels(
this.channels.filter((channel) => {
const membership = channel.currentUserMembership;
@@ -451,10 +431,6 @@ export default class ChatChannelsManager extends Service {
* @returns {number|null} Sort value (-1, 0, 1) or null if no starred sorting needed
*/
#compareStarredChannels(a, b, property) {
- if (!this.siteSettings.star_chat_channels) {
- return null;
- }
-
const aStarred = a.currentUserMembership?.starred;
const bStarred = b.currentUserMembership?.starred;
diff --git a/plugins/chat/assets/javascripts/discourse/services/chat.js b/plugins/chat/assets/javascripts/discourse/services/chat.js
index 46c41612791..db81a333888 100644
--- a/plugins/chat/assets/javascripts/discourse/services/chat.js
+++ b/plugins/chat/assets/javascripts/discourse/services/chat.js
@@ -299,26 +299,17 @@ export default class Chat extends Service {
}
/**
- * Returns channels in sidebar display order.
- * When starred channels are enabled, returns: starred, public, DMs.
- * Otherwise returns: public, DMs.
+ * Returns channels in sidebar display order: starred, public, DMs.
*
* @returns {Array} Ordered array of chat channels matching sidebar order
*/
#getOrderedChannels() {
const manager = this.chatChannelsManager;
- if (this.siteSettings.star_chat_channels) {
- return [
- ...manager.starredChannels,
- ...manager.unstarredPublicMessageChannels,
- ...manager.truncatedUnstarredDirectMessageChannels,
- ];
- }
-
return [
- ...manager.publicMessageChannels,
- ...manager.truncatedDirectMessageChannels,
+ ...manager.starredChannels,
+ ...manager.unstarredPublicMessageChannels,
+ ...manager.truncatedUnstarredDirectMessageChannels,
];
}
@@ -333,31 +324,23 @@ export default class Chat extends Service {
#getOrderedChannelsWithActivity(activeChannel) {
const manager = this.chatChannelsManager;
- let allChannels;
- if (this.siteSettings.star_chat_channels) {
- // Filter each section for channels with activity
- const starredWithActivity = manager.starredChannels.filter(
- (c) => c.hasUnread
- );
- const publicWithActivity = manager.unstarredPublicMessageChannels.filter(
+ // Filter each section for channels with activity
+ const starredWithActivity = manager.starredChannels.filter(
+ (c) => c.hasUnread
+ );
+ const publicWithActivity = manager.unstarredPublicMessageChannels.filter(
+ (c) => c.hasUnread
+ );
+ const dmsWithActivity =
+ manager.truncatedUnstarredDirectMessageChannels.filter(
(c) => c.hasUnread
);
- const dmsWithActivity =
- manager.truncatedUnstarredDirectMessageChannels.filter(
- (c) => c.hasUnread
- );
- allChannels = [
- ...starredWithActivity,
- ...publicWithActivity,
- ...dmsWithActivity,
- ];
- } else {
- allChannels = [
- ...manager.publicMessageChannelsWithActivity,
- ...manager.directMessageChannelsWithActivity,
- ];
- }
+ const allChannels = [
+ ...starredWithActivity,
+ ...publicWithActivity,
+ ...dmsWithActivity,
+ ];
// If the active channel has no unread messages, insert it at its proper position
if (!activeChannel.hasUnread) {
diff --git a/plugins/chat/config/locales/server.en.yml b/plugins/chat/config/locales/server.en.yml
index 50e12811168..51c4cd9b3dd 100644
--- a/plugins/chat/config/locales/server.en.yml
+++ b/plugins/chat/config/locales/server.en.yml
@@ -26,7 +26,6 @@ en:
chat_preferred_index: "Preferred tab when loading /chat."
allow_chat_in_anonymous_mode: "Enable this setting to allow users who are browsing your site anonymously to use chat. This setting requires the `allow anonymous mode` setting to be enabled."
chat_search_enabled: "Enable this setting to allow users to search chat messages."
- star_chat_channels: "Enable starring of chat channels. Starred channels will be in their own dedicated section on the sidebar for quick access."
errors:
chat_default_channel: "The default chat channel must be a public channel."
direct_message_enabled_groups_invalid: "You must specify at least one group for this setting. If you do not want anyone except staff to send direct messages, choose the staff group."
diff --git a/plugins/chat/config/settings.yml b/plugins/chat/config/settings.yml
index 12aec876097..6600a050f3a 100644
--- a/plugins/chat/config/settings.yml
+++ b/plugins/chat/config/settings.yml
@@ -153,10 +153,3 @@ chat:
validator: "Chat::AllowChatInAnonymousModeValidator"
depends_on:
- "allow_anonymous_mode"
- star_chat_channels:
- default: false
- hidden: true
- client: true
- upcoming_change:
- status: "experimental"
- impact: "feature,all_members"
diff --git a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb
index 57bffc15d0c..add0bfcc09c 100644
--- a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb
+++ b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb
@@ -7,7 +7,6 @@ describe Chat::Api::ChannelsCurrentUserMembershipController do
before do
SiteSetting.chat_enabled = true
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
- SiteSetting.star_chat_channels = true
sign_in(current_user)
end
diff --git a/plugins/chat/spec/services/chat/update_user_channel_membership_spec.rb b/plugins/chat/spec/services/chat/update_user_channel_membership_spec.rb
index 12d0fc234d9..f8279506419 100644
--- a/plugins/chat/spec/services/chat/update_user_channel_membership_spec.rb
+++ b/plugins/chat/spec/services/chat/update_user_channel_membership_spec.rb
@@ -23,8 +23,6 @@ RSpec.describe Chat::UpdateUserChannelMembership do
let(:params) { { channel_id: channel.id, starred: true } }
let(:dependencies) { { guardian: current_user.guardian } }
- before { SiteSetting.star_chat_channels = true }
-
context "when contract is invalid" do
let(:params) { { starred: true } }
diff --git a/plugins/chat/spec/system/drawer/starred_channels_spec.rb b/plugins/chat/spec/system/drawer/starred_channels_spec.rb
index 336e07bafae..c81817d61dd 100644
--- a/plugins/chat/spec/system/drawer/starred_channels_spec.rb
+++ b/plugins/chat/spec/system/drawer/starred_channels_spec.rb
@@ -10,7 +10,6 @@ RSpec.describe "Drawer - starred channels", type: :system do
before do
chat_system_bootstrap
- SiteSetting.star_chat_channels = true
channel_1.add(current_user)
channel_2.add(current_user)
sign_in(current_user)
@@ -63,20 +62,6 @@ RSpec.describe "Drawer - starred channels", type: :system do
end
end
- context "when star_chat_channels setting is disabled" do
- before do
- channel_1.membership_for(current_user).update!(starred: true)
- SiteSetting.star_chat_channels = false
- end
-
- it "does not show starred tab in footer" do
- visit("/")
- chat_page.open_from_header
-
- expect(page).to have_no_css("#c-footer-starred")
- end
- end
-
context "when user has starred both channels and DMs" do
fab!(:user_1, :user)
fab!(:user_2, :user)
diff --git a/plugins/chat/spec/system/shortcuts/sidebar_spec.rb b/plugins/chat/spec/system/shortcuts/sidebar_spec.rb
index 260238bcac3..da9c23b5da1 100644
--- a/plugins/chat/spec/system/shortcuts/sidebar_spec.rb
+++ b/plugins/chat/spec/system/shortcuts/sidebar_spec.rb
@@ -47,14 +47,13 @@ RSpec.describe "Shortcuts | sidebar", type: :system do
end
end
- context "when star_chat_channels is enabled" do
+ context "when there are starred channels" do
fab!(:alpha_channel) { Fabricate(:chat_channel, name: "Alpha Channel") }
fab!(:beta_channel) { Fabricate(:chat_channel, name: "Beta Channel") }
fab!(:other_user, :user)
fab!(:dm_channel_2) { Fabricate(:direct_message_channel, users: [current_user, other_user]) }
before do
- SiteSetting.star_chat_channels = true
# Unfollow channel_1 from parent context to make tests independent
channel_1.membership_for(current_user).update!(following: false)
alpha_channel.add(current_user)
diff --git a/plugins/chat/spec/system/starred_channels_spec.rb b/plugins/chat/spec/system/starred_channels_spec.rb
index 26047540b6e..e896212eb61 100644
--- a/plugins/chat/spec/system/starred_channels_spec.rb
+++ b/plugins/chat/spec/system/starred_channels_spec.rb
@@ -9,7 +9,6 @@ RSpec.describe "Starred channels", type: :system do
before do
chat_system_bootstrap
SiteSetting.navigation_menu = "sidebar"
- SiteSetting.star_chat_channels = true
sign_in(current_user)
end
@@ -270,31 +269,6 @@ RSpec.describe "Starred channels", type: :system do
end
end
- context "when the star_chat_channels setting is disabled" do
- fab!(:channel_1) { Fabricate(:category_channel, name: "Channel A") }
-
- before do
- channel_1.add(current_user)
- channel_1.membership_for(current_user).update!(starred: true)
- SiteSetting.star_chat_channels = false
- end
-
- it "does not show the Starred Channels section" do
- visit("/")
-
- expect(page).to have_no_css("#sidebar-section-content-chat-starred-channels")
- expect(page.find("#sidebar-section-content-chat-channels")).to have_css(
- ".channel-#{channel_1.id}",
- )
- end
-
- it "does not show the star button in the channel navbar" do
- chat_page.visit_channel(channel_1)
-
- expect(page).to have_no_css(".c-navbar__star-channel-button")
- end
- end
-
context "when using the navbar star button" do
fab!(:channel_1) { Fabricate(:category_channel, name: "Channel A") }
diff --git a/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js
index e8c9640ae5f..b6930194e7a 100644
--- a/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js
+++ b/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js
@@ -12,8 +12,6 @@ module(
hooks.beforeEach(function () {
this.subject = getOwner(this).lookup("service:chat-channels-manager");
this.fabricators = new ChatFabricators(getOwner(this));
- this.siteSettings = getOwner(this).lookup("service:site-settings");
- this.siteSettings.star_chat_channels = true;
});
module("#sortChannelsByActivity with starred channels", function () {
@@ -151,38 +149,7 @@ module(
});
module("#unstarredPublicMessageChannelsByActivity", function () {
- test("returns all channels sorted by activity when starring is disabled", function (assert) {
- this.siteSettings.star_chat_channels = false;
-
- const channelA = this.fabricators.channel({
- chatable: this.fabricators.coreFabricators.category({
- slug: "channel-a",
- }),
- });
- const channelB = this.fabricators.channel({
- chatable: this.fabricators.coreFabricators.category({
- slug: "channel-b",
- }),
- });
-
- channelA.currentUserMembership = UserChatChannelMembership.create({
- following: true,
- starred: true,
- });
- channelB.currentUserMembership = UserChatChannelMembership.create({
- following: true,
- starred: false,
- });
-
- this.subject.store(channelA);
- this.subject.store(channelB);
-
- const result = this.subject.unstarredPublicMessageChannelsByActivity;
-
- assert.strictEqual(result.length, 2, "returns all channels");
- });
-
- test("excludes starred channels when starring is enabled", function (assert) {
+ test("excludes starred channels", function (assert) {
const starredChannel = this.fabricators.channel({
chatable: this.fabricators.coreFabricators.category({
slug: "starred-channel",
@@ -264,28 +231,6 @@ module(
});
module("#starredChannelsByActivity", function () {
- test("returns empty array when starring is disabled", function (assert) {
- this.siteSettings.star_chat_channels = false;
-
- const channel = this.fabricators.channel({
- chatable: this.fabricators.coreFabricators.category({
- slug: "test",
- }),
- });
- channel.currentUserMembership = UserChatChannelMembership.create({
- following: true,
- starred: true,
- });
-
- this.subject.store(channel);
-
- assert.strictEqual(
- this.subject.starredChannelsByActivity.length,
- 0,
- "returns empty array"
- );
- });
-
test("sorts starred channels with unreads first", function (assert) {
const channelWithUnread = this.fabricators.channel({
chatable: this.fabricators.coreFabricators.category({