diff --git a/src/domain/session/rightpanel/MemberTileViewModel.js b/src/domain/session/rightpanel/MemberTileViewModel.js index fd5ba096..c6c489de 100644 --- a/src/domain/session/rightpanel/MemberTileViewModel.js +++ b/src/domain/session/rightpanel/MemberTileViewModel.js @@ -6,8 +6,8 @@ export class MemberTileViewModel extends ViewModel { this._member = options.member; } - get displayName() { - return this._member.displayName; + get name() { + return this._member.name; } get userId() { diff --git a/src/domain/session/rightpanel/comparator.js b/src/domain/session/rightpanel/comparator.js index b369c5f2..d4f86176 100644 --- a/src/domain/session/rightpanel/comparator.js +++ b/src/domain/session/rightpanel/comparator.js @@ -5,7 +5,7 @@ export function createMemberComparator(powerLevels) { const p1 = powerLevels.getUserLevel(member.userId); const p2 = powerLevels.getUserLevel(otherMember.userId); if (p1 !== p2) { return p2 - p1; } - return member.displayName?.localeCompare(otherMember.displayName); + return member.name?.localeCompare(otherMember.name); }; } @@ -25,67 +25,67 @@ export function tests() { return { "power_level(member1) > power_level(member2) returns value <= 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": 50}); - const member1 = {userId: "@alice:hs.tld", displayName: "alice"}; - const member2 = {userId: "@bob:hs.tld", displayName: "bob"}; + const member1 = {userId: "@alice:hs.tld", name: "alice"}; + const member2 = {userId: "@bob:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2) <= 0, true); }, "power_level(member1) < power_level(member2) returns value > 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": 50}); - const member1 = {userId: "@bob:hs.tld", displayName: "bob"}; - const member2 = {userId: "@alice:hs.tld", displayName: "alice"}; + const member1 = {userId: "@bob:hs.tld", name: "bob"}; + const member2 = {userId: "@alice:hs.tld", name: "alice"}; assert.strictEqual(fn(member1, member2) > 0, true); }, - "alphabetic compare on displayName": assert => { + "alphabetic compare on name": assert => { const fn = createComparatorWithPowerLevel(); - const member1 = {userId: "@bob:hs.tld", displayName: "bob"}; - const member2 = {userId: "@alice:hs.tld", displayName: "alice"}; + const member1 = {userId: "@bob:hs.tld", name: "bob"}; + const member2 = {userId: "@alice:hs.tld", name: "alice"}; assert.strictEqual(fn(member1, member2) > 0, true); assert.strictEqual(fn(member2, member1) <= 0, true); }, "alphabetic compare with case (alice comes before Bob)": assert => { const fn = createComparatorWithPowerLevel(); - const member1 = {userId: "@bob:hs.tld", displayName: "Bob"}; - const member2 = {userId: "@alice:hs.tld", displayName: "alice"}; + const member1 = {userId: "@bob:hs.tld", name: "Bob"}; + const member2 = {userId: "@alice:hs.tld", name: "alice"}; assert.strictEqual(fn(member1, member2) > 0, true); assert.strictEqual(fn(member2, member1) <= 0, true); }, "equal powerlevel and same names returns 0": assert => { const fn = createComparatorWithPowerLevel({"@bobby:hs.tld": 50, "@bob:hs.tld": 50}); - const member1 = {userId: "@bob:hs.tld", displayName: "bob"}; - const member2 = {userId: "@bobby:hs.tld", displayName: "bob"}; + const member1 = {userId: "@bob:hs.tld", name: "bob"}; + const member2 = {userId: "@bobby:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2), 0); assert.strictEqual(fn(member2, member1), 0); }, "(both_negative_powerlevel) power_level(member1) < power_level(member2) returns value > 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": -100, "@bob:hs.tld": -50}); - const member1 = {userId: "@alice:hs.tld", displayName: "alice"}; - const member2 = {userId: "@bob:hs.tld", displayName: "bob"}; + const member1 = {userId: "@alice:hs.tld", name: "alice"}; + const member2 = {userId: "@bob:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2) > 0, true); }, "(both_negative_powerlevel) power_level(member1) > power_level(member2) returns value <= 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": -50, "@bob:hs.tld": -100}); - const member1 = {userId: "@alice:hs.tld", displayName: "alice"}; - const member2 = {userId: "@bob:hs.tld", displayName: "bob"}; + const member1 = {userId: "@alice:hs.tld", name: "alice"}; + const member2 = {userId: "@bob:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2) <= 0, true); }, "(one_negative_powerlevel) power_level(member1) > power_level(member2) returns value <= 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": 50, "@bob:hs.tld": -100}); - const member1 = {userId: "@alice:hs.tld", displayName: "alice"}; - const member2 = {userId: "@bob:hs.tld", displayName: "bob"}; + const member1 = {userId: "@alice:hs.tld", name: "alice"}; + const member2 = {userId: "@bob:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2) <= 0, true); }, "(one_negative_powerlevel) power_level(member1) < power_level(member2) returns value > 0": assert => { const fn = createComparatorWithPowerLevel({"@alice:hs.tld": -100, "@bob:hs.tld": 50}); - const member1 = {userId: "@alice:hs.tld", displayName: "alice"}; - const member2 = {userId: "@bob:hs.tld", displayName: "bob"}; + const member1 = {userId: "@alice:hs.tld", name: "alice"}; + const member2 = {userId: "@bob:hs.tld", name: "bob"}; assert.strictEqual(fn(member1, member2) > 0, true); }, }; diff --git a/src/platform/web/ui/session/rightpanel/MemberTileView.js b/src/platform/web/ui/session/rightpanel/MemberTileView.js index e4b010a4..59d61b62 100644 --- a/src/platform/web/ui/session/rightpanel/MemberTileView.js +++ b/src/platform/web/ui/session/rightpanel/MemberTileView.js @@ -2,6 +2,6 @@ import {TemplateView} from "../../general/TemplateView.js"; export class MemberTileView extends TemplateView { render(t, vm) { - return t.div(vm.displayName); + return t.div(vm.name); } }