mirror of
https://github.com/revoltchat/revite.git
synced 2025-01-12 23:41:25 -05:00
fix: choose the first channel in the server if none is selected
This commit is contained in:
parent
4787a2166f
commit
55a7b00954
1 changed files with 4 additions and 0 deletions
|
@ -62,7 +62,11 @@ const ServerSidebar = observer((props: Props) => {
|
||||||
if (!server) return <Redirect to="/" />;
|
if (!server) return <Redirect to="/" />;
|
||||||
|
|
||||||
const channel = channel_id ? client.channels.get(channel_id) : undefined;
|
const channel = channel_id ? client.channels.get(channel_id) : undefined;
|
||||||
|
|
||||||
|
// The user selected no channel, let's see if there's a channel available
|
||||||
|
if (!channel && server.channel_ids.length > 0) return <Redirect to={`/server/${server_id}/channel/${server.channel_ids[0]}`} />;
|
||||||
if (channel_id && !channel) return <Redirect to={`/server/${server_id}`} />;
|
if (channel_id && !channel) return <Redirect to={`/server/${server_id}`} />;
|
||||||
|
|
||||||
if (channel) useUnreads({ ...props, channel });
|
if (channel) useUnreads({ ...props, channel });
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Reference in a new issue