mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Sort memberlist using powerlevel
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
3e23392a0e
commit
a9ff6ab026
@ -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) {
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user