Add links

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-21 14:36:26 +05:30
parent fe6551ff3c
commit f9b1068bae
2 changed files with 12 additions and 4 deletions

View file

@ -25,7 +25,7 @@ export class MemberDetailsViewModel extends ViewModel {
this._member = this._observableMember.get();
this._isEncrypted = options.isEncrypted;
this._powerLevelsObservable = options.powerLevelsObservable;
this._powerLevel = this._powerLevelFromObservable(this._powerLevelsObservable);
this._powerLevel = this._powerLevelsObservable.get().getUserLevel(this._member.userId);
this.track(this._powerLevelsObservable.subscribe(() => this._onPowerLevelsChange()));
this.track(this._observableMember.subscribe( () => this._onMemberChange()));
}
@ -72,4 +72,12 @@ export class MemberDetailsViewModel extends ViewModel {
get isEncrypted() {
return this._isEncrypted;
}
get dmLink() {
return `${this.urlCreator.urlUntilSegment("session")}/open-room/${this._member.userId}`;
}
get linkToUser() {
return `https://matrix.to/#/${this._member.userId}`;
}
}

View file

@ -45,10 +45,10 @@ export class MemberDetailsView extends TemplateView {
return t.div({ className: "MemberDetailsView_section" },
[
t.div({className: "MemberDetailsView_label"}, vm.i18n`OPTIONS`),
t.div({ className: "MemberDetailsView_options" },
t.div({className: "MemberDetailsView_options"},
[
t.a({href: "#"}, vm.i18n`Direct Message`),
t.a({href: "#"}, vm.i18n`Open Link to User`)
t.a({href: vm.dmLink}, vm.i18n`Direct Message`),
t.a({href: vm.linkToUser, target: "_blank", rel: "noopener"}, vm.i18n`Open Link to User`)
])
]);
}