@@ -7,7 +7,17 @@ import {
77} from "@fedify/fedify" ;
88import { zValidator } from "@hono/zod-validator" ;
99import { getLogger } from "@logtape/logtape" ;
10- import { and , desc , eq , ilike , inArray , lte , or , sql } from "drizzle-orm" ;
10+ import {
11+ and ,
12+ desc ,
13+ eq ,
14+ ilike ,
15+ inArray ,
16+ isNull ,
17+ lte ,
18+ or ,
19+ sql ,
20+ } from "drizzle-orm" ;
1121import { Hono } from "hono" ;
1222import { z } from "zod" ;
1323import { db } from "../../db" ;
@@ -79,6 +89,7 @@ app.get(
7989 ? await db . query . posts . findMany ( {
8090 where : and (
8191 or ( eq ( posts . iri , q ) , eq ( posts . url , q ) ) ,
92+ isNull ( posts . sharingId ) ,
8293 lte ( posts . published , sql `NOW() + INTERVAL '5 minutes'` ) ,
8394 ) ,
8495 with : getPostRelations ( owner . id ) ,
@@ -135,7 +146,10 @@ app.get(
135146 }
136147 }
137148 if ( query . type == null || query . type === "statuses" ) {
138- let filter = ilike ( posts . content , `%${ q } %` ) ;
149+ let filter = and (
150+ ilike ( posts . contentHtml , `%${ q } %` ) ,
151+ isNull ( posts . sharingId ) ,
152+ ) ! ;
139153 if ( query . account_id != null ) {
140154 filter = and ( filter , eq ( posts . accountId , query . account_id ) ) ! ;
141155 }
0 commit comments