diff --git a/src/domain/session/rightpanel/MemberListViewModel.js b/src/domain/session/rightpanel/MemberListViewModel.js index 691efd0d..737fb6cf 100644 --- a/src/domain/session/rightpanel/MemberListViewModel.js +++ b/src/domain/session/rightpanel/MemberListViewModel.js @@ -1,15 +1,12 @@ import {ViewModel} from "../../ViewModel.js"; import {MemberTileViewModel} from "./MemberTileViewModel.js"; - -function comparator(member, otherMember) { - return member.displayName?.localeCompare(otherMember.displayName); -} +import {createMemberComparator} from "./comparator.js"; export class MemberListViewModel extends ViewModel { constructor(options) { super(options); this.memberTileViewModels = this._mapTileViewModels(this._filterJoinedMembers(options.members)) - .sortValues(comparator); + .sortValues(createMemberComparator(options.powerLevels)); } _filterJoinedMembers(members) { diff --git a/src/domain/session/rightpanel/RightPanelViewModel.js b/src/domain/session/rightpanel/RightPanelViewModel.js index a9cdc23b..3010f79c 100644 --- a/src/domain/session/rightpanel/RightPanelViewModel.js +++ b/src/domain/session/rightpanel/RightPanelViewModel.js @@ -38,8 +38,9 @@ export class RightPanelViewModel extends ViewModel { if (enable) { const list = await this._room.loadMemberList(); const members = list.members; + const powerLevels = this._room.powerLevels; this._memberListViewModel = this.track( - new MemberListViewModel(this.childOptions({members})) + new MemberListViewModel(this.childOptions({members, powerLevels})) ); } this.emitChange("memberListViewModel");