mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
Merge pull request #206 from goaaats/fix/default_channel
This commit is contained in:
@@ -5,8 +5,6 @@ import { ServerPermission } from "revolt.js/dist/api/permissions";
|
|||||||
import { Server } from "revolt.js/dist/maps/Servers";
|
import { Server } from "revolt.js/dist/maps/Servers";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
|
||||||
|
|
||||||
import Header from "../ui/Header";
|
import Header from "../ui/Header";
|
||||||
import IconButton from "../ui/IconButton";
|
import IconButton from "../ui/IconButton";
|
||||||
|
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user