Skip to content

Commit

Permalink
Fix: MUC occupant list does not sort itself on nicknames or roles cha…
Browse files Browse the repository at this point in the history
…nges
  • Loading branch information
JohnXLivingston committed Jan 17, 2024
1 parent 5975323 commit 20ce019
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- #2716: Fix issue with chat display when opening via URL
- #3033: Add the `muc_grouped_by_domain` option to display MUCs on the same domain in collapsible groups
- Add an occupants filter to the MUC sidebar
- Fix: MUC occupant list does not sort itself on nicknames or roles changes

### Breaking changes:

Expand Down
5 changes: 5 additions & 0 deletions src/headless/plugins/muc/occupants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const { u } = converse.env;
class ChatRoomOccupants extends Collection {
model = ChatRoomOccupant;

initialize() {
this.on('change:nick', () => this.sort());
this.on('change:role', () => this.sort());
}

comparator (occupant1, occupant2) { // eslint-disable-line class-methods-use-this
const role1 = occupant1.get('role') || 'none';
const role2 = occupant2.get('role') || 'none';
Expand Down

0 comments on commit 20ce019

Please sign in to comment.