Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix /myroomavatar slash command (#9536)
Browse files Browse the repository at this point in the history
(cherry picked from commit f35d01f)
  • Loading branch information
t3chguy authored and github-actions[bot] committed Nov 3, 2022
1 parent ad87b32 commit edf0d4a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}
},
});
};
Expand Down

0 comments on commit edf0d4a

Please sign in to comment.