mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-25 19:52:31 +01:00
prevent navigating to non-text channels
This commit is contained in:
parent
dd81402647
commit
eb962bd804
@ -67,8 +67,13 @@ function ChannelList() {
|
||||
key={channel.id}
|
||||
isCategory={isCategory}
|
||||
onClick={() =>
|
||||
{
|
||||
// prevent navigating to non-text channels
|
||||
if (!channel.isTextChannel) return;
|
||||
|
||||
navigate(`/channels/${guild.id}/${channel.id}`)
|
||||
}
|
||||
}
|
||||
>
|
||||
<FirstWrapper isCategory={isCategory} active={active}>
|
||||
{channel.channelIcon && (
|
||||
|
@ -14,7 +14,7 @@ import type {
|
||||
Snowflake as SnowflakeType,
|
||||
} from "@spacebarchat/spacebar-api-types/v9";
|
||||
import { ChannelType, Routes } from "@spacebarchat/spacebar-api-types/v9";
|
||||
import { action, makeObservable, observable } from "mobx";
|
||||
import { action, computed, makeObservable, observable } from "mobx";
|
||||
import AppStore from "../AppStore";
|
||||
import MessageStore from "../MessageStore";
|
||||
import { APIError } from "../../utils/interfaces/api";
|
||||
@ -208,4 +208,20 @@ export default class Channel {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@computed
|
||||
get isTextChannel() {
|
||||
return (
|
||||
this.type === ChannelType.GuildText ||
|
||||
this.type === ChannelType.GuildStore ||
|
||||
this.type === ChannelType.GuildForum ||
|
||||
this.type === ChannelType.AnnouncementThread ||
|
||||
this.type === ChannelType.Encrypted ||
|
||||
this.type === ChannelType.EncryptedThread ||
|
||||
this.type === ChannelType.PrivateThread ||
|
||||
this.type === ChannelType.PublicThread ||
|
||||
this.type === ChannelType.GroupDM ||
|
||||
this.type === ChannelType.DM
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user