Remove the seriouscritter notifications section
Reverts6537c34and its syntax fix4bdfae1. The section only regrouped a user's own notifications from that account (duplicating them in the list), and the actorId filter it added to listNotifications was never used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FQFD3mtUWSZpeLbKzkCohh
This commit is contained in:
@@ -103,27 +103,15 @@ export async function toNotificationDTOs(rows: Row[]): Promise<NotificationDTO[]
|
||||
}
|
||||
|
||||
/** Newest first, 30 at a time; the cursor is the last one's time. */
|
||||
export async function listNotifications(
|
||||
userId: string,
|
||||
cursor: string | null,
|
||||
actorId?: string // Added optional actorId filter
|
||||
): Promise<{
|
||||
notifications: NotificationDTO[];
|
||||
unread: number;
|
||||
nextCursor: string | null;
|
||||
}> {
|
||||
export async function listNotifications(userId: string, cursor: string | null) {
|
||||
const n = schema.notifications;
|
||||
const before = cursor ? new Date(cursor) : null;
|
||||
const query = db
|
||||
const rows = await db
|
||||
.select()
|
||||
.from(n)
|
||||
.where(and(
|
||||
eq(n.userId, userId),
|
||||
before && !isNaN(before.getTime()) ? lt(n.createdAt, before) : undefined,
|
||||
actorId ? eq(n.actorId, actorId) : undefined // Apply actor filter if provided
|
||||
));
|
||||
|
||||
const rows = await query.orderBy(desc(n.createdAt)).limit(31);
|
||||
.where(and(eq(n.userId, userId), before && !isNaN(before.getTime()) ? lt(n.createdAt, before) : undefined))
|
||||
.orderBy(desc(n.createdAt))
|
||||
.limit(31);
|
||||
const page = rows.slice(0, 30);
|
||||
return {
|
||||
notifications: await toNotificationDTOs(page),
|
||||
|
||||
Reference in New Issue
Block a user