CBAN window: the join button switches the active view to the suggested channel

This commit is contained in:
Jean Chevronnet 2026-07-27 01:03:16 +00:00
parent 431432feb5
commit aed817a105
No known key found for this signature in database

View file

@ -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}>