Adds replies to Yoten
+23
internal/consumer/ingester.go
+23
internal/consumer/ingester.go
···
627
}
628
629
log.Println("upserting comment from pds request")
630
+
631
+
632
+
633
+
return fmt.Errorf("failed to upsert comment record: %w", err)
634
+
}
635
+
636
+
// Create a comment if not commenting on self post.
637
+
if subjectDid.String() != did {
638
+
err = db.CreateNotification(tx, subjectDid.String(), did, subjectUri.String(), db.NotificationTypeComment)
639
+
if err != nil {
640
+
log.Println("failed to create notification record:", err)
641
+
}
642
+
}
643
+
644
+
// Notify comment creator of reply if not replying to their own comment.
645
+
if comment.ParentCommentUri != nil && comment.ParentCommentUri.Authority().String() != did {
646
+
err = db.CreateNotification(tx, comment.ParentCommentUri.Authority().String(), did, parentCommentUri.String(), db.NotificationTypeReply)
647
+
if err != nil {
648
+
log.Println("failed to create notification record:", err)
649
+
}
650
+
}
651
+
652
+
return tx.Commit()
internal/db/comment.go
internal/db/comment.go
This file has not been changed.
internal/server/handlers/comment.go
internal/server/handlers/comment.go
This file has not been changed.
internal/server/handlers/router.go
internal/server/handlers/router.go
This file has not been changed.
internal/server/handlers/study-session.go
internal/server/handlers/study-session.go
This file has not been changed.
internal/server/views/partials/comment-feed.templ
internal/server/views/partials/comment-feed.templ
This file has not been changed.
internal/server/views/partials/comment.templ
internal/server/views/partials/comment.templ
This file has not been changed.
internal/server/views/partials/discussion.templ
internal/server/views/partials/discussion.templ
This file has not been changed.
internal/server/views/partials/edit-comment.templ
internal/server/views/partials/edit-comment.templ
This file has not been changed.
internal/server/views/partials/new-reply.templ
internal/server/views/partials/new-reply.templ
This file has not been changed.
internal/server/views/partials/partials.go
internal/server/views/partials/partials.go
This file has not been changed.
internal/server/views/partials/reply.templ
internal/server/views/partials/reply.templ
This file has not been changed.
internal/server/views/study-session.templ
internal/server/views/study-session.templ
This file has not been changed.
+1
-1
migrations/update_notification_type.sql
+1
-1
migrations/update_notification_type.sql
···
11
actor_did TEXT NOT NULL,
12
subject_uri TEXT NOT NULL,
13
state TEXT NOT NULL DEFAULT 'unread' CHECK(state IN ('unread', 'read')),
14
-
type TEXT NOT NULL CHECK(type IN ('follow', 'reaction', 'comment')),
15
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
16
FOREIGN KEY (recipient_did) REFERENCES profiles(did) ON DELETE CASCADE,
17
FOREIGN KEY (actor_did) REFERENCES profiles(did) ON DELETE CASCADE
···
11
actor_did TEXT NOT NULL,
12
subject_uri TEXT NOT NULL,
13
state TEXT NOT NULL DEFAULT 'unread' CHECK(state IN ('unread', 'read')),
14
+
type TEXT NOT NULL CHECK(type IN ('follow', 'reaction', 'comment', 'reply')),
15
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
16
FOREIGN KEY (recipient_did) REFERENCES profiles(did) ON DELETE CASCADE,
17
FOREIGN KEY (actor_did) REFERENCES profiles(did) ON DELETE CASCADE
+1
internal/db/notification.go
+1
internal/db/notification.go
History
2 rounds
0 comments
brookjeynes.dev
submitted
#1
expand 0 comments
pull request successfully merged
brookjeynes.dev
submitted
#0