mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-22 10:22:30 +01:00
prevent navigating to non-text channels
This commit is contained in:
parent
dd81402647
commit
eb962bd804
@ -67,7 +67,12 @@ function ChannelList() {
|
||||
key={channel.id}
|
||||
isCategory={isCategory}
|
||||
onClick={() =>
|
||||
navigate(`/channels/${guild.id}/${channel.id}`)
|
||||
{
|
||||
// prevent navigating to non-text channels
|
||||
if (!channel.isTextChannel) return;
|
||||
|
||||
navigate(`/channels/${guild.id}/${channel.id}`)
|
||||
}
|
||||
}
|
||||
>
|
||||
<FirstWrapper isCategory={isCategory} active={active}>
|
||||
|
@ -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