[Backport staging] Fix /myroomavatar slash command (#9537)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>pull/28788/head^2
parent
ad87b32e1b
commit
e58681ee73
|
@ -76,7 +76,7 @@ interface HTMLInputEvent extends Event {
|
||||||
target: HTMLInputElement & EventTarget;
|
target: HTMLInputElement & EventTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
const singleMxcUpload = async (): Promise<any> => {
|
const singleMxcUpload = async (): Promise<string | null> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const fileSelector = document.createElement('input');
|
const fileSelector = document.createElement('input');
|
||||||
fileSelector.setAttribute('type', 'file');
|
fileSelector.setAttribute('type', 'file');
|
||||||
|
@ -85,8 +85,13 @@ const singleMxcUpload = async (): Promise<any> => {
|
||||||
|
|
||||||
Modal.createDialog(UploadConfirmDialog, {
|
Modal.createDialog(UploadConfirmDialog, {
|
||||||
file,
|
file,
|
||||||
onFinished: (shouldContinue) => {
|
onFinished: async (shouldContinue) => {
|
||||||
resolve(shouldContinue ? MatrixClientPeg.get().uploadContent(file) : null);
|
if (shouldContinue) {
|
||||||
|
const { content_uri: uri } = await MatrixClientPeg.get().uploadContent(file);
|
||||||
|
resolve(uri);
|
||||||
|
} else {
|
||||||
|
resolve(null);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue