diff --git a/CHANGES.md b/CHANGES.md index 51bf94c389..47f61056b8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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: diff --git a/src/headless/plugins/muc/occupants.js b/src/headless/plugins/muc/occupants.js index c47c6e5b04..dc26335845 100644 --- a/src/headless/plugins/muc/occupants.js +++ b/src/headless/plugins/muc/occupants.js @@ -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';