forked from mystiq/hydrogen-web
Create getter
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
28a0a0830f
commit
a16c3aacab
1 changed files with 13 additions and 5 deletions
|
@ -25,7 +25,7 @@ export class MemberDetailsViewModel extends ViewModel {
|
||||||
this._member = this._observableMember.get();
|
this._member = this._observableMember.get();
|
||||||
this._isEncrypted = options.isEncrypted;
|
this._isEncrypted = options.isEncrypted;
|
||||||
this._powerLevelsObservable = options.powerLevelsObservable;
|
this._powerLevelsObservable = options.powerLevelsObservable;
|
||||||
this._powerLevel = this._powerLevelsObservable.get().getUserLevel(this._member.userId);
|
this._powerLevel = null;
|
||||||
this.track(this._powerLevelsObservable.subscribe(() => this._onPowerLevelsChange()));
|
this.track(this._powerLevelsObservable.subscribe(() => this._onPowerLevelsChange()));
|
||||||
this.track(this._observableMember.subscribe( () => this._onMemberChange()));
|
this.track(this._observableMember.subscribe( () => this._onMemberChange()));
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,10 @@ export class MemberDetailsViewModel extends ViewModel {
|
||||||
get previousSegmentName() { return "members"; }
|
get previousSegmentName() { return "members"; }
|
||||||
|
|
||||||
get role() {
|
get role() {
|
||||||
if (this._powerLevel >= 100) { return "Admin"; }
|
if (this.powerLevel >= 100) { return "Admin"; }
|
||||||
else if (this._powerLevel >= 50) { return "Moderator"; }
|
else if (this.powerLevel >= 50) { return "Moderator"; }
|
||||||
else if (this._powerLevel === 0) { return "Default"; }
|
else if (this.powerLevel === 0) { return "Default"; }
|
||||||
else { return `Custom (${this._powerLevel})`; }
|
else { return `Custom (${this.powerLevel})`; }
|
||||||
}
|
}
|
||||||
|
|
||||||
_onMemberChange() {
|
_onMemberChange() {
|
||||||
|
@ -75,6 +75,14 @@ export class MemberDetailsViewModel extends ViewModel {
|
||||||
return this._isEncrypted;
|
return this._isEncrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get powerLevel() {
|
||||||
|
if (!this._powerLevel) {
|
||||||
|
const powerLevels = this._powerLevelsObservable.get();
|
||||||
|
this._powerLevel = powerLevels.getUserLevel(this._member.userId);
|
||||||
|
}
|
||||||
|
return this._powerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
get linkToUser() {
|
get linkToUser() {
|
||||||
return `https://matrix.to/#/${this._member.userId}`;
|
return `https://matrix.to/#/${this._member.userId}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue