mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +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 {ViewModel} from "../../ViewModel.js";
|
||||||
import {MemberTileViewModel} from "./MemberTileViewModel.js";
|
import {MemberTileViewModel} from "./MemberTileViewModel.js";
|
||||||
|
import {createMemberComparator} from "./comparator.js";
|
||||||
function comparator(member, otherMember) {
|
|
||||||
return member.displayName?.localeCompare(otherMember.displayName);
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MemberListViewModel extends ViewModel {
|
export class MemberListViewModel extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
this.memberTileViewModels = this._mapTileViewModels(this._filterJoinedMembers(options.members))
|
this.memberTileViewModels = this._mapTileViewModels(this._filterJoinedMembers(options.members))
|
||||||
.sortValues(comparator);
|
.sortValues(createMemberComparator(options.powerLevels));
|
||||||
}
|
}
|
||||||
|
|
||||||
_filterJoinedMembers(members) {
|
_filterJoinedMembers(members) {
|
||||||
|
@ -38,8 +38,9 @@ export class RightPanelViewModel extends ViewModel {
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
const list = await this._room.loadMemberList();
|
const list = await this._room.loadMemberList();
|
||||||
const members = list.members;
|
const members = list.members;
|
||||||
|
const powerLevels = this._room.powerLevels;
|
||||||
this._memberListViewModel = this.track(
|
this._memberListViewModel = this.track(
|
||||||
new MemberListViewModel(this.childOptions({members}))
|
new MemberListViewModel(this.childOptions({members, powerLevels}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.emitChange("memberListViewModel");
|
this.emitChange("memberListViewModel");
|
||||||
|
Loading…
Reference in New Issue
Block a user