diff --git a/src/domain/session/rightpanel/MemberListViewModel.js b/src/domain/session/rightpanel/MemberListViewModel.js index f7e2afc0..48d99747 100644 --- a/src/domain/session/rightpanel/MemberListViewModel.js +++ b/src/domain/session/rightpanel/MemberListViewModel.js @@ -1,12 +1,14 @@ import {ViewModel} from "../../ViewModel.js"; import {MemberTileViewModel} from "./MemberTileViewModel.js"; import {createMemberComparator} from "./comparator.js"; +import {Disambiguator} from "./disambiguator.js"; export class MemberListViewModel extends ViewModel { constructor(options) { super(options); this.memberTileViewModels = this._mapTileViewModels(this._filterJoinedMembers(options.members)) .sortValues(createMemberComparator(options.powerLevels)); + this.nameDisambiguator = new Disambiguator(); } _filterJoinedMembers(members) { @@ -14,10 +16,16 @@ export class MemberListViewModel extends ViewModel { } _mapTileViewModels(members) { - const mapper = (member, emitUpdate) => { - return new MemberTileViewModel(this.childOptions({member, emitUpdate})); + const mapper = (member, emitChange) => { + const vm = new MemberTileViewModel(this.childOptions({member, emitChange})); + this.nameDisambiguator.disambiguate(vm); + return vm; } - const updater = (vm, params, newMember) => vm.updateFrom(newMember); + const updater = (vm, params, newMember) => { + vm.updateFrom(newMember); + this.nameDisambiguator.disambiguate(vm); + }; return members.mapValues(mapper, updater); } + }