summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteCreateService.ts
diff options
context:
space:
mode:
authorHazel K <acomputerdog@gmail.com>2024-10-09 15:09:55 -0400
committerHazelnoot <acomputerdog@gmail.com>2024-10-15 14:16:46 -0400
commit463b9ac59def86dd1b9065cbe7382325c1e5824e (patch)
tree99f8d32eac6e0974b372dd1adf66acb1f989083c /packages/backend/src/core/NoteCreateService.ts
parentremove un-necessary assignment to query (diff)
downloadsharkey-463b9ac59def86dd1b9065cbe7382325c1e5824e.tar.gz
sharkey-463b9ac59def86dd1b9065cbe7382325c1e5824e.tar.bz2
sharkey-463b9ac59def86dd1b9065cbe7382325c1e5824e.zip
add filters for following feed
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 03701c33e5..cbc9dcaf8f 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -63,7 +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';
+import { isPureRenote } from '@/misc/is-renote.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@@ -1151,18 +1151,21 @@ export class NoteCreateService implements OnApplicationShutdown {
if (note.visibility === 'specified') return;
// Ignore pure renotes
- if (isRenote(note) && !isQuote(note)) return;
+ if (isPureRenote(note)) return;
+
+ // Compute the compound key of the entry to check
+ const key = SkLatestNote.keyFor(note);
// 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 });
+ const currentLatest = await this.latestNotesRepository.findOneBy(key);
if (currentLatest != null && currentLatest.noteId >= note.id) return;
// Record this as the latest note for the given user
const latestNote = new SkLatestNote({
- userId: note.userId,
+ ...key,
noteId: note.id,
});
- await this.latestNotesRepository.upsert(latestNote, ['userId']);
+ await this.latestNotesRepository.upsert(latestNote, ['userId', 'isPublic', 'isReply', 'isQuote']);
}
}