mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-22 10:11:39 +01:00
expose user trust in member panel
This commit is contained in:
parent
4c7f784911
commit
149f187904
@ -29,10 +29,22 @@ export class MemberDetailsViewModel extends ViewModel {
|
||||
this._session = options.session;
|
||||
this.track(this._powerLevelsObservable.subscribe(() => this._onPowerLevelsChange()));
|
||||
this.track(this._observableMember.subscribe( () => this._onMemberChange()));
|
||||
this._isTrusted = false;
|
||||
this.init(); // TODO: call this from parent view model and do something smart with error view model if it fails async?
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (this.features.crossSigning) {
|
||||
this._isTrusted = await this.logger.run({l: "MemberDetailsViewModel.verify user", id: this._member.userId}, log => {
|
||||
return this._session.crossSigning.isUserTrusted(this._member.userId, log);
|
||||
});
|
||||
this.emitChange("isTrusted");
|
||||
}
|
||||
}
|
||||
|
||||
get name() { return this._member.name; }
|
||||
get userId() { return this._member.userId; }
|
||||
get isTrusted() { return this._isTrusted; }
|
||||
|
||||
get type() { return "member-details"; }
|
||||
get shouldShowBackButton() { return true; }
|
||||
|
@ -19,15 +19,22 @@ import {TemplateView} from "../../general/TemplateView";
|
||||
|
||||
export class MemberDetailsView extends TemplateView {
|
||||
render(t, vm) {
|
||||
const securityNodes = [
|
||||
t.p(vm.isEncrypted ?
|
||||
vm.i18n`Messages in this room are end-to-end encrypted.` :
|
||||
vm.i18n`Messages in this room are not end-to-end encrypted.`),
|
||||
]
|
||||
|
||||
if (vm.features.crossSigning) {
|
||||
securityNodes.push(t.p(vm => vm.isTrusted ? vm.i18n`This user is trusted` : vm.i18n`This user is not trusted`));
|
||||
}
|
||||
|
||||
return t.div({className: "MemberDetailsView"},
|
||||
[ t.view(new AvatarView(vm, 128)),
|
||||
t.div({className: "MemberDetailsView_name"}, t.h2(vm => vm.name)),
|
||||
t.div({className: "MemberDetailsView_id"}, vm.userId),
|
||||
this._createSection(t, vm.i18n`Role`, vm => vm.role),
|
||||
this._createSection(t, vm.i18n`Security`, vm.isEncrypted ?
|
||||
vm.i18n`Messages in this room are end-to-end encrypted.` :
|
||||
vm.i18n`Messages in this room are not end-to-end encrypted.`
|
||||
),
|
||||
this._createSection(t, vm.i18n`Security`, securityNodes),
|
||||
this._createOptions(t, vm)
|
||||
]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user