mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 17:23:18 +00:00
🐛 fix permissions if user is only member of guild
This commit is contained in:
1 parent
8e025ce57c
commit
14628d80ba
2 files changed
+7
-5
No files matched your search
@@ -15,13 +15,13 @@ export default router;
|
||||
|
||||
export function isTextChannel(type: ChannelType): boolean {
|
||||
switch (type) {
|
||||
case ChannelType.GUILD_STORE:
|
||||
case ChannelType.GUILD_VOICE:
|
||||
case ChannelType.GUILD_CATEGORY:
|
||||
throw new HTTPError("not a text channel", 400);
|
||||
case ChannelType.DM:
|
||||
case ChannelType.GROUP_DM:
|
||||
case ChannelType.GUILD_NEWS:
|
||||
case ChannelType.GUILD_STORE:
|
||||
case ChannelType.GUILD_TEXT:
|
||||
return true;
|
||||
}
|
||||
@@ -48,8 +48,7 @@ router.get("/", async (req: Request, res: Response) => {
|
||||
if (!limit) limit = 50;
|
||||
var halfLimit = Math.floor(limit / 2);
|
||||
|
||||
// @ts-ignore
|
||||
const permissions = await getPermission(req.user_id, channel.guild_id, channel_id, { channel });
|
||||
const permissions = await getPermission(req.user_id, channel.guild_id, channel_id);
|
||||
permissions.hasThrow("VIEW_CHANNEL");
|
||||
if (!permissions.has("READ_MESSAGE_HISTORY")) return res.json([]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user