refactor: 🚸 only index public posts

This commit is contained in:
ThatOneCalculator 2023-08-09 19:39:01 -07:00
parent c456b1082d
commit cf8a733927
No known key found for this signature in database
GPG key ID: 8703CACD01000000
2 changed files with 2 additions and 1 deletions

View file

@ -85,6 +85,7 @@ export default define(meta, paramDef, async (ps, me) => {
query query
.andWhere("note.text ILIKE :q", { q: `%${sqlLikeEscape(ps.query)}%` }) .andWhere("note.text ILIKE :q", { q: `%${sqlLikeEscape(ps.query)}%` })
.andWhere("note.visibility = 'public'")
.innerJoinAndSelect("note.user", "user") .innerJoinAndSelect("note.user", "user")
.leftJoinAndSelect("user.avatar", "avatar") .leftJoinAndSelect("user.avatar", "avatar")
.leftJoinAndSelect("user.banner", "banner") .leftJoinAndSelect("user.banner", "banner")

View file

@ -806,7 +806,7 @@ async function insertNote(
} }
export async function index(note: Note, reindexing: boolean): Promise<void> { export async function index(note: Note, reindexing: boolean): Promise<void> {
if (!note.text) return; if (!note.text || note.visibility === "public") return;
if (config.elasticsearch && es) { if (config.elasticsearch && es) {
es.index({ es.index({