show cross-sign user option in right panel

This commit is contained in:
Bruno Windels 2023-03-02 17:16:53 +01:00
parent 3a303ff84d
commit fa662db70b
3 changed files with 22 additions and 5 deletions

View File

@ -54,6 +54,14 @@ export class MemberDetailsViewModel extends ViewModel {
this.emitChange("role"); this.emitChange("role");
} }
async signUser() {
if (this._session.crossSigning) {
await this.logger.run("MemberDetailsViewModel.signUser", async log => {
await this._session.crossSigning.signUser(this.userId, log);
});
}
}
get avatarLetter() { get avatarLetter() {
return avatarInitials(this.name); return avatarInitials(this.name);
} }

View File

@ -1182,6 +1182,7 @@ button.RoomDetailsView_row::after {
border: none; border: none;
background: none; background: none;
cursor: pointer; cursor: pointer;
text-align: left;
} }
.LazyListParent { .LazyListParent {

View File

@ -41,14 +41,22 @@ export class MemberDetailsView extends TemplateView {
} }
_createOptions(t, vm) { _createOptions(t, vm) {
const options = [
t.a({href: vm.linkToUser, target: "_blank", rel: "noopener"}, vm.i18n`Open Link to User`),
t.button({className: "text", onClick: () => vm.openDirectMessage()}, vm.i18n`Open direct message`)
];
if (vm.features.crossSigning) {
const onClick = () => {
if (confirm("You don't want to do this with any account but a test account. This will cross-sign this user without verifying their keys first. You won't be able to undo this apart from resetting your cross-signing keys.")) {
vm.signUser();
}
}
options.push(t.button({className: "text", onClick}, vm.i18n`Cross-sign user (DO NOT USE, TESTING ONLY)`))
}
return t.div({ className: "MemberDetailsView_section" }, return t.div({ className: "MemberDetailsView_section" },
[ [
t.div({className: "MemberDetailsView_label"}, vm.i18n`Options`), t.div({className: "MemberDetailsView_label"}, vm.i18n`Options`),
t.div({className: "MemberDetailsView_options"}, t.div({className: "MemberDetailsView_options"}, options)
[
t.a({href: vm.linkToUser, target: "_blank", rel: "noopener"}, vm.i18n`Open Link to User`),
t.button({className: "text", onClick: () => vm.openDirectMessage()}, vm.i18n`Open direct message`)
])
]); ]);
} }
} }