Merge branch 'feature/default-post-target-detect-from-path' into develop_test

This commit is contained in:
mesi 2024-01-23 10:42:17 +09:00
commit 5ec94f9948

View file

@ -603,23 +603,37 @@ export function post(props: Record<string, any> = {}): Promise<void> {
// もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが // もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが
const route = mainRouter.getCurrentPath().split('/'); const route = mainRouter.getCurrentPath().split('/');
if (route[1] === 'channels') props = { if (route[1] === 'channels' && !props.channel) {
...props, misskeyApi('channels/show', {
// 本当はチャンネル名や色もほしいけどどっからとってこよう channelId: route[2],
channel: { }).then(channel => {
id: route[2], props = {
}, ...props,
}; channel: { ...channel },
};
return makePostFormPopup(props);
}).catch(err => {
console.error(err);
alert({
type: 'error',
text: err.message,
});
});
} else {
makePostFormPopup(props);
}
});
}
let dispose; function makePostFormPopup(props) {
popup(MkPostFormDialog, props, { let dispose;
closed: () => { popup(MkPostFormDialog, props, {
resolve(); closed: () => {
dispose(); resolve();
}, dispose();
}).then(res => { },
dispose = res.dispose; }).then(res => {
}); dispose = res.dispose;
}); });
} }