Fix /myroomavatar slash command (#9536)

pull/28788/head^2
Michael Telatynski 2022-11-03 11:47:12 +00:00 committed by GitHub
parent c79f45e5e6
commit f35d01f5df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -76,7 +76,7 @@ interface HTMLInputEvent extends Event {
target: HTMLInputElement & EventTarget;
}
const singleMxcUpload = async (): Promise<any> => {
const singleMxcUpload = async (): Promise<string | null> => {
return new Promise((resolve) => {
const fileSelector = document.createElement('input');
fileSelector.setAttribute('type', 'file');
@ -85,8 +85,13 @@ const singleMxcUpload = async (): Promise<any> => {
Modal.createDialog(UploadConfirmDialog, {
file,
onFinished: (shouldContinue) => {
resolve(shouldContinue ? MatrixClientPeg.get().uploadContent(file) : null);
onFinished: async (shouldContinue) => {
if (shouldContinue) {
const { content_uri: uri } = await MatrixClientPeg.get().uploadContent(file);
resolve(uri);
} else {
resolve(null);
}
},
});
};