Skip to content

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

Revert "FEATURE: Change channel priority sorting logic (#44743)" (#44842)

Penar Musaraj8aa4ee71836b
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 adc927c0bb9..f5beb06993e 100644
--- a/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js
+++ b/plugins/chat/assets/javascripts/discourse/services/chat-channels-manager.js
@@ -574,8 +574,6 @@ export default class ChatChannelsManager extends Service {
if (priority) {
return priority;
}
-
- return this.#compareChannelsAlphabetically(channelA, channelB);
}
return (
diff --git a/plugins/chat/assets/stylesheets/common/chat-channel-list-options.scss b/plugins/chat/assets/stylesheets/common/chat-channel-list-options.scss
index 4a4a7f26b44..61052d3fba6 100644
--- a/plugins/chat/assets/stylesheets/common/chat-channel-list-options.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-channel-list-options.scss
@@ -20,13 +20,6 @@
min-width: 17rem;
}
-.chat-channel-list-sort-menu {
- &__priority {
- white-space: normal;
- text-align: left;
- }
-}
-
.chat-channel-list-filter-menu .dropdown-menu__item,
.chat-channel-list-sort-menu .dropdown-menu__item,
.chat-channel-list-sort-choice {
diff --git a/plugins/chat/config/locales/client.en.yml b/plugins/chat/config/locales/client.en.yml
index 5002b360113..260292cfdee 100644
--- a/plugins/chat/config/locales/client.en.yml
+++ b/plugins/chat/config/locales/client.en.yml
@@ -671,7 +671,7 @@ en:
alphabetical: "Alphabetically"
recent_activity: "Recent activity"
priority: "Priority"
- priority_description: "Mentions, then unreads, then recent activity, each sorted alphabetically"
+ priority_description: "Mentions, then unreads, then recent activity"
empty:
filtered: "No channels match this filter."
show_all: "Show all channels"
diff --git a/plugins/chat/spec/system/list_channels/drawer_spec.rb b/plugins/chat/spec/system/list_channels/drawer_spec.rb
index 9214f248c8e..2ccfe332bd6 100644
--- a/plugins/chat/spec/system/list_channels/drawer_spec.rb
+++ b/plugins/chat/spec/system/list_channels/drawer_spec.rb
@@ -68,20 +68,6 @@ RSpec.describe "List channels | Drawer" do
it "sorts by urgent, unread messages or threads first when priority is selected" do
current_user.user_option.update!(chat_channel_list_sort: "priority")
- Fabricate(
- :chat_message,
- chat_channel: channel_1,
- user: current_user,
- created_at: 1.day.ago,
- use_service: true,
- )
- Fabricate(
- :chat_message,
- chat_channel: channel_2,
- user: current_user,
- created_at: 1.hour.ago,
- use_service: true,
- )
drawer_page.visit_index
Fabricate(
@@ -235,7 +221,7 @@ RSpec.describe "List channels | Drawer" do
Fabricate(:direct_message_channel, users: [current_user, user_3], threading_enabled: true)
end
- it "sorts unread direct messages before read ones when priority is selected" do
+ it "sorts them by latest activity" do
current_user.user_option.update!(chat_channel_list_sort_dms: "priority")
Fabricate(
@@ -259,10 +245,7 @@ RSpec.describe "List channels | Drawer" do
expect(drawer_page).to have_channel_at_position(dm_channel_2, 1)
expect(drawer_page).to have_urgent_channel(dm_channel_2)
- channel_ids =
- page.all(".chat-channel-row").map { |channel| channel["data-chat-channel-id"] }
- expect(channel_ids.index(dm_channel_4.id.to_s)).to be >
- channel_ids.index(dm_channel_2.id.to_s)
+ expect(drawer_page).to have_channel_at_position(dm_channel_4, 2)
end
context "with unread threads" do
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 179dc2e487e..90246b9c4b6 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
@@ -589,46 +589,26 @@ module("Unit | Service | chat-channels-manager", function (hooks) {
test("sorts urgent, unread, and read channels by priority", function (assert) {
this.preferences.channelsSort = CHAT_CHANNEL_LIST_SORTS.PRIORITY;
- this.buildChannel({ id: 1, slug: "read-zulu", createdAt: "2026-09-03" });
- this.buildChannel({ id: 4, slug: "read-alpha", createdAt: "2026-09-01" });
+ this.buildChannel({ id: 1, slug: "read", createdAt: "2026-09-03" });
this.buildChannel({
id: 2,
- slug: "unread-zulu",
+ slug: "unread",
createdAt: "2026-09-01",
unreadCount: 1,
});
- this.buildChannel({
- id: 5,
- slug: "unread-alpha",
- createdAt: "2026-09-03",
- unreadCount: 1,
- });
this.buildChannel({
id: 3,
- slug: "urgent-zulu",
+ slug: "urgent",
createdAt: "2026-08-30",
mentionCount: 1,
});
- this.buildChannel({
- id: 6,
- slug: "urgent-alpha",
- createdAt: "2026-09-04",
- mentionCount: 1,
- });
assert.deepEqual(
this.subject.sidebarPublicMessageChannels.map(
(channel) => channel.slug
),
- [
- "urgent-alpha",
- "urgent-zulu",
- "unread-alpha",
- "unread-zulu",
- "read-alpha",
- "read-zulu",
- ],
- "priority groups are ordered alphabetically"
+ ["urgent", "unread", "read"],
+ "priority groups are ordered"
);
});
@@ -958,46 +938,26 @@ module("Unit | Service | chat-channels-manager", function (hooks) {
test("sorts urgent, unread, and read channels by priority", function (assert) {
this.preferences.channelsSort = CHAT_CHANNEL_LIST_SORTS.PRIORITY;
- this.buildChannel({ id: 1, slug: "read-zulu", createdAt: "2026-09-03" });
- this.buildChannel({ id: 4, slug: "read-alpha", createdAt: "2026-09-01" });
+ this.buildChannel({ id: 1, slug: "read", createdAt: "2026-09-03" });
this.buildChannel({
id: 2,
- slug: "unread-zulu",
+ slug: "unread",
createdAt: "2026-09-01",
unreadCount: 1,
});
- this.buildChannel({
- id: 5,
- slug: "unread-alpha",
- createdAt: "2026-09-03",
- unreadCount: 1,
- });
this.buildChannel({
id: 3,
- slug: "urgent-zulu",
+ slug: "urgent",
createdAt: "2026-08-30",
mentionCount: 1,
});
- this.buildChannel({
- id: 6,
- slug: "urgent-alpha",
- createdAt: "2026-09-04",
- mentionCount: 1,
- });
assert.deepEqual(
this.subject.publicMessageChannelsByPreference.map(
(channel) => channel.slug
),
- [
- "urgent-alpha",
- "urgent-zulu",
- "unread-alpha",
- "unread-zulu",
- "read-alpha",
- "read-zulu",
- ],
- "priority places each group in alphabetical order"
+ ["urgent", "unread", "read"],
+ "priority places urgent, then unread, then read channels"
);
});
@@ -1507,8 +1467,8 @@ module("Unit | Service | chat-channels-manager", function (hooks) {
assert.deepEqual(
this.subject.starredChannelsByPreference.map((c) => c.slug),
- ["alpha", "zulu"],
- "starred honors its own priority sort alphabetically"
+ ["zulu", "alpha"],
+ "starred honors its own priority sort"
);
assert.deepEqual(
this.subject.publicMessageChannelsByPreference.map((c) => c.slug),