mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
Merge pull request #206 from goaaats/fix/default_channel
This commit is contained in:
commit
f925479121
2 changed files with 4 additions and 2 deletions
|
@ -5,8 +5,6 @@ import { ServerPermission } from "revolt.js/dist/api/permissions";
|
|||
import { Server } from "revolt.js/dist/maps/Servers";
|
||||
import styled from "styled-components";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import Header from "../ui/Header";
|
||||
import IconButton from "../ui/IconButton";
|
||||
|
||||
|
|
|
@ -62,7 +62,11 @@ const ServerSidebar = observer((props: Props) => {
|
|||
if (!server) return <Redirect to="/" />;
|
||||
|
||||
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) useUnreads({ ...props, channel });
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in a new issue