mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-04 00:55:25 +00:00
Fix guild discovery
This commit is contained in:
@@ -20,7 +20,7 @@ import { Config, Guild, Member } from "@spacebar/util";
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { In, Like, Not } from "typeorm";
|
||||
import { ArrayContains, In, Like, Not } from "typeorm";
|
||||
import { DiscoverableGuildsResponse } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
@@ -51,7 +51,7 @@ router.get(
|
||||
id: Not(In(hiddenGuildIds)),
|
||||
discovery_excluded: false,
|
||||
...(categories == undefined ? {} : { primary_category_id: categories.toString() }), // TODO: isnt this an array?
|
||||
...(showAllGuilds ? {} : { features: Like("%DISCOVERABLE%") }),
|
||||
...(showAllGuilds ? {} : { features: ArrayContains(["DISCOVERABLE"]) }),
|
||||
},
|
||||
order: {
|
||||
discovery_weight: "DESC",
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Config, Guild } from "@spacebar/util";
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Like } from "typeorm";
|
||||
import { ArrayContains, Like } from "typeorm";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
@@ -44,7 +44,7 @@ router.get(
|
||||
const guilds = showAllGuilds
|
||||
? await Guild.find({ take: Math.abs(Number(limit || 24)) })
|
||||
: await Guild.find({
|
||||
where: { features: Like("%DISCOVERABLE%") },
|
||||
where: { features: ArrayContains(["DISCOVERABLE"]) },
|
||||
take: Math.abs(Number(limit || 24)),
|
||||
});
|
||||
res.send({
|
||||
|
||||
Reference in New Issue
Block a user