diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 3c13ef022d..7f942dc83b 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -919,7 +919,8 @@ export class NoteCreateService implements OnApplicationShutdown { const config = loadConfig(); let defaultTag:string | null = config.tagging.defaultTag; if (defaultTag != null) { - if (note.visibility === 'public' && note.tags.includes(normalizeForSearch(defaultTag))) { + const noteTags = note.tags ? note.tags.map((t: string) => t.toLowerCase()) : []; + if (note.visibility === 'public' && noteTags.includes(normalizeForSearch(defaultTag))) { this.fanoutTimelineService.push('localTimelineWithReplies', note.id, 300, r); this.fanoutTimelineService.push('localTimeline', note.id, 1000, r); if (note.fileIds.length > 0) { diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index dba9261214..4ad55e3dce 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -155,11 +155,16 @@ export default class extends Endpoint { // eslint- let defaultTag:string | null = config.tagging.defaultTag; const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId) - .andWhere( - (defaultTag == null) - ? '(note.visibility = \'public\') AND (note.userHost IS NULL) AND (note.channelId IS NULL)' - : `(note.visibility = 'public') AND ('${normalizeForSearch(defaultTag)}' = any(note.tags) AND (note.channelId IS NULL)` - ) + .andWhere(new Brackets(qb => { + qb.andWhere('note.visibility = \'public\''); + qb.andWhere('note.channelId IS NULL'); + if (defaultTag == null) { + qb.andWhere('note.userHost IS NULL'); + } else { + qb.andWhere(`':t' = any(note.tags)`, { t: normalizeForSearch(defaultTag) }); + } + } + )) .innerJoinAndSelect('note.user', 'user') .leftJoinAndSelect('note.reply', 'reply') .leftJoinAndSelect('note.renote', 'renote')