From acc0c7867fcc44650f9ada06286f35a103ceec1e Mon Sep 17 00:00:00 2001 From: Hazel K Date: Mon, 30 Sep 2024 13:29:15 -0400 Subject: [PATCH] exclude boosts from featured timeline --- packages/backend/src/core/NoteCreateService.ts | 4 ++++ packages/backend/src/core/NoteDeleteService.ts | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 17631eea89..0af65b81b1 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -63,6 +63,7 @@ import { isReply } from '@/misc/is-reply.js'; import { trackPromise } from '@/misc/promise-tracker.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { isQuote, isRenote } from '@/misc/is-renote.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -1136,6 +1137,9 @@ export class NoteCreateService implements OnApplicationShutdown { // Ignore DMs if (note.visibility === 'specified') return; + // Ignore pure renotes + if (isRenote(note) && !isQuote(note)) return; + // Make sure that this isn't an *older* post. // We can get older posts through replies, lookups, etc. const currentLatest = await this.latestNotesRepository.findOneBy({ userId: note.userId }); diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts index 898e164966..de753a3aa2 100644 --- a/packages/backend/src/core/NoteDeleteService.ts +++ b/packages/backend/src/core/NoteDeleteService.ts @@ -240,14 +240,25 @@ export class NoteDeleteService { // If it's a DM, then it can't possibly be the latest note so we can safely skip this. if (note.visibility === 'specified') return; - // Find the newest remaining note for the user + // Find the newest remaining note for the user. + // We exclude DMs and pure renotes. const nextLatest = await this.notesRepository - .createQueryBuilder() + .createQueryBuilder('note') .select() .where({ userId: note.userId, visibility: Not('specified'), }) + .andWhere(` + ( + note."renoteId" IS NULL + OR note.text IS NOT NULL + OR note.cw IS NOT NULL + OR note."replyId" IS NOT NULL + OR note."hasPoll" + OR note."fileIds" != '{}' + ) + `) .orderBy({ id: 'DESC' }) .getOne(); if (!nextLatest) return;