mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-01 02:46:20 +01:00
Merge branch 'feature/default-post-target-detect-from-path' into develop_test
This commit is contained in:
commit
5ec94f9948
1 changed files with 30 additions and 16 deletions
|
@ -603,23 +603,37 @@ export function post(props: Record<string, any> = {}): Promise<void> {
|
|||
// もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが
|
||||
|
||||
const route = mainRouter.getCurrentPath().split('/');
|
||||
if (route[1] === 'channels') 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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue