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

Commit e58681e

Browse files
RiotRobott3chguy
andauthored
[Backport staging] Fix /myroomavatar slash command (#9537)
Co-authored-by: Michael Telatynski <[email protected]>
1 parent ad87b32 commit e58681e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/SlashCommands.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ interface HTMLInputEvent extends Event {
7676
target: HTMLInputElement & EventTarget;
7777
}
7878

79-
const singleMxcUpload = async (): Promise<any> => {
79+
const singleMxcUpload = async (): Promise<string | null> => {
8080
return new Promise((resolve) => {
8181
const fileSelector = document.createElement('input');
8282
fileSelector.setAttribute('type', 'file');
@@ -85,8 +85,13 @@ const singleMxcUpload = async (): Promise<any> => {
8585

8686
Modal.createDialog(UploadConfirmDialog, {
8787
file,
88-
onFinished: (shouldContinue) => {
89-
resolve(shouldContinue ? MatrixClientPeg.get().uploadContent(file) : null);
88+
onFinished: async (shouldContinue) => {
89+
if (shouldContinue) {
90+
const { content_uri: uri } = await MatrixClientPeg.get().uploadContent(file);
91+
resolve(uri);
92+
} else {
93+
resolve(null);
94+
}
9095
},
9196
});
9297
};

0 commit comments

Comments
 (0)