CBAN window: the join button switches the active view to the suggested channel
This commit is contained in:
parent
431432feb5
commit
aed817a105
1 changed files with 4 additions and 1 deletions
|
|
@ -10,11 +10,14 @@ export function CbanModal() {
|
|||
const setModal = useActiveChat((s) => s.setModal);
|
||||
const cban = useActiveChat((s) => s.cban);
|
||||
const client = useActiveChat((s) => s.client);
|
||||
const setActive = useActiveChat((s) => s.setActive);
|
||||
if (!cban) return null;
|
||||
|
||||
const suggested = (cban.reason.match(/#[^\s,.:;!?]+/) || [])[0];
|
||||
const close = () => setModal('');
|
||||
const joinSuggested = () => { if (suggested) client?.join(suggested); close(); };
|
||||
// Join the suggested channel AND switch the active view to it (same as the
|
||||
// join dialog / the /join command), so the user lands in #accueil.
|
||||
const joinSuggested = () => { if (suggested) { client?.join(suggested); setActive(suggested); } close(); };
|
||||
|
||||
return (
|
||||
<Modal title={t('modals.cban.title')} onClose={close}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue