From 4910f315d4492b4b80142461bcd854c3c9b6882d Mon Sep 17 00:00:00 2001 From: mesi Date: Mon, 22 Jan 2024 04:43:43 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=87=E3=82=B0=E3=83=AC=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/os.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 5292dd3d25..4849bafddb 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -603,7 +603,7 @@ export function post(props: Record = {}): Promise { // もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが const route = mainRouter.getCurrentPath().split('/'); - if (route[1] === 'channels') props = { + if (route[1] === 'channels' && !props.channel) props = { ...props, // 本当はチャンネル名や色もほしいけどどっからとってこよう channel: { From 252f517b221a0dbececd39edb0c459df0dafa95c Mon Sep 17 00:00:00 2001 From: mesi Date: Tue, 23 Jan 2024 10:32:06 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E3=81=AB=E3=83=81=E3=83=A3=E3=83=B3=E3=83=8D=E3=83=AB=E3=81=AE?= =?UTF-8?q?=E8=89=B2=E6=83=85=E5=A0=B1=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/os.ts | 46 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 9802989962..e2535f9ebf 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -603,23 +603,37 @@ export function post(props: Record = {}): Promise { // もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが const route = mainRouter.getCurrentPath().split('/'); - if (route[1] === 'channels' && !props.channel) props = { - ...props, - // 本当はチャンネル名や色もほしいけどどっからとってこよう - channel: { - id: route[2], - }, - }; + if (route[1] === 'channels' && !props.channel) { + misskeyApi('channels/show', { + channelId: route[2], + }).then(channel => { + props = { + ...props, + channel: { ...channel }, + }; + return makePostFormPopup(props); + }).catch(err => { + console.error(err); + alert({ + type: 'error', + text: err.message, + }); + }); + } else { + makePostFormPopup(props); + } + }); +} - let dispose; - popup(MkPostFormDialog, props, { - closed: () => { - resolve(); - dispose(); - }, - }).then(res => { - dispose = res.dispose; - }); +function makePostFormPopup(props) { + let dispose; + popup(MkPostFormDialog, props, { + closed: () => { + resolve(); + dispose(); + }, + }).then(res => { + dispose = res.dispose; }); }