This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

appview/db: add read filter for pending email notifs

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>

author
Anirudh Oppiliappan
date (Jul 22, 2026, 6:57 PM +0300) commit 4966693a parent cc3b7534 change-id yxnokmvt
+8 -4
+8 -4
appview/db/notifications.go
··· 551 551 } 552 552 553 553 // GetPendingEmailDigestRecipients returns DIDs of users who have email 554 - // notifications enabled, have a verified primary email, and have unemaileD 555 - // notifications older than olderThan for email-eligible notification types. 554 + // notifications enabled, have a verified primary email, and have unread, 555 + // unemailed notifications older than olderThan for email-eligible notification 556 + // types. 556 557 func GetPendingEmailDigestRecipients(e Execer, olderThan time.Time) ([]string, error) { 557 558 placeholders := make([]string, len(models.EmailNotificationTypes)) 558 559 args := []any{olderThan.UTC().Format(time.RFC3339)} ··· 568 569 JOIN notification_preferences np ON np.user_did = n.recipient_did 569 570 JOIN emails e ON e.did = n.recipient_did AND e.is_primary = 1 AND e.verified = 1 570 571 WHERE n.emailed = 0 572 + AND n.read = 0 571 573 AND n.created < ? 572 574 AND np.email_notifications = 1 573 575 AND n.type IN (%s) ··· 590 592 return dids, rows.Err() 591 593 } 592 594 593 - // GetPendingNotificationsForEmailDigest returns all unemailed notifications 594 - // older than olderThan for email-eligible types for a specific recipient. 595 + // GetPendingNotificationsForEmailDigest returns all unread, unemailed 596 + // notifications older than olderThan for email-eligible types for a specific 597 + // recipient. 595 598 func GetPendingNotificationsForEmailDigest(e Execer, recipientDid string, olderThan time.Time) ([]*models.NotificationWithEntity, error) { 596 599 placeholders := make([]string, len(models.EmailNotificationTypes)) 597 600 args := []any{recipientDid, olderThan.UTC().Format(time.RFC3339)} ··· 614 617 LEFT JOIN pulls p ON n.pull_id = p.id 615 618 WHERE n.recipient_did = ? 616 619 AND n.emailed = 0 620 + AND n.read = 0 617 621 AND n.created < ? 618 622 AND n.type IN (%s) 619 623 ORDER BY n.created DESC