Skip to content

Fix #1851: Sort open groupchats alphabetically when grouped by domain#3983

Open
cj-l920 wants to merge 1 commit intoconversejs:masterfrom
cj-l920:master
Open

Fix #1851: Sort open groupchats alphabetically when grouped by domain#3983
cj-l920 wants to merge 1 commit intoconversejs:masterfrom
cj-l920:master

Conversation

@cj-l920
Copy link
Copy Markdown

@cj-l920 cj-l920 commented Apr 2, 2026

Problem Summary

Fixes #1851: Open Groupchats not sorted in any order

When the muc_grouped_by_domain configuration option is enabled, rooms within each domain group were not being sorted alphabetically. This made it difficult for users to find specific groupchats in the list.

Solution Approach

Added alphabetical sorting to the tplRoomDomainGroupList function in src/plugins/roomslist/templates/roomslist.js.

The fix ensures that:

  1. Rooms are sorted by their display name (case-insensitive) before being grouped by domain
  2. The existing domain sorting behavior is maintained
  3. The sort is stable and consistent

Changes Made

  • Modified tplRoomDomainGroupList() to sort rooms alphabetically using getDisplayName()
  • Used case-insensitive comparison (toLowerCase()) for consistent ordering
  • Added a copy of the rooms array to avoid mutating the original

Test Evidence

  • Code compiles without errors
  • Sorting logic follows the same pattern used in getRoomsToShow() in view.js
  • Case-insensitive sorting ensures "Room A" and "room a" are ordered correctly
  • Original array is not mutated (uses spread operator copy)

Example

Before (random order within domain):
example.com
Zebra Chat
Alpha Room
Beta Group
After (alphabetically sorted):
example.com
Alpha Room
Beta Group
Zebra Chat
Fixes #1851

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open Groupchats not sorted in any order

1 participant