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

Fix /myroomavatar slash command #9536

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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