デフォルトハッシュタグタイムライン

This commit is contained in:
Tatsuya Koishi 2024-01-27 19:31:58 +09:00
parent 2d7a2a3d6a
commit 5667f5affd
2 changed files with 12 additions and 6 deletions

View file

@ -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) {

View file

@ -155,11 +155,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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')