Merge pull request #206 from goaaats/fix/default_channel

This commit is contained in:
Paul Makles 2021-09-09 20:53:15 +01:00 committed by GitHub
commit f925479121
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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";

View file

@ -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(() => {