From d24fedc018e2dfebb62c9165bd020e8eec86c238 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 24 Apr 2021 00:36:43 +0900 Subject: [PATCH] https://github.com/misskey-dev/misskey/pull/7129/files/b562e86e4b2e4e8ce7755f45942ee0c56db71ff7#diff-717ec8c25ed5a94845484eac4c62a3c7b93e341a757c5cf491f2ecb746d25879 --- src/client/pages/share.vue | 63 ++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/client/pages/share.vue b/src/client/pages/share.vue index 43ed1aeeec..874bd7c144 100644 --- a/src/client/pages/share.vue +++ b/src/client/pages/share.vue @@ -94,7 +94,9 @@ export default defineComponent({ if (localOnly === '0') this.localOnly = false; else if (localOnly === '1') this.localOnly = true; - await Promise.all([(async () => { + + try { + //#region Reply const replyId = urlParams.get('replyId'); const replyUri = urlParams.get('replyUri'); if (replyId) { @@ -109,33 +111,40 @@ export default defineComponent({ this.reply = obj.object; } } - })(),(async () => { - const renoteId = urlParams.get('renoteId'); - const renoteUri = urlParams.get('renoteUri'); - if (renoteId) { - this.renote = await os.api('notes/show', { - noteId: renoteId - }); - } else if (renoteUri) { - const obj = await os.api('ap/show', { - uri: renoteUri - }) as any; - if (obj.type === 'Note') { - this.renote = obj.object; + //#endregion + + //#region Renote + const renoteId = urlParams.get('renoteId'); + const renoteUri = urlParams.get('renoteUri'); + if (renoteId) { + this.renote = await os.api('notes/show', { + noteId: renoteId + }); + } else if (renoteUri) { + const obj = await os.api('ap/show', { + uri: renoteUri + }) as any; + if (obj.type === 'Note') { + this.renote = obj.object; + } } - } - })(),(async () => { - const fileIds = urlParams.get('fileIds'); - if (fileIds) { - const promises = Promise.all(fileIds.split(',') - .map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`)))); - await promises.then(files => this.files = files); - } - })(),]).catch(e => os.dialog({ - type: 'error', - title: e.message, - text: e.name - })); + //#endregion + + //#region Drive files + const fileIds = urlParams.get('fileIds'); + if (fileIds) { + const promises = Promise.all(fileIds.split(',') + .map(fileId => os.api('drive/files/show', { fileId }).catch(() => Error(`invalid fileId: ${fileId}`)))); + await promises.then(files => this.files = files); + } + //#endregion + } catch (e) { + os.dialog({ + type: 'error', + title: e.message, + text: e.name + }); + } this.state = 'writing'; },