mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-05 23:36:00 +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サイドのバグなのだが
|
// もちろん複数の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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue