feat: add post mention
This commit is contained in:
@@ -380,6 +380,20 @@ func (r *NotificationRepo) UpsertLike(ctx context.Context, userID, actorID, post
|
||||
return count, emailDue, nil
|
||||
}
|
||||
|
||||
// CreateMention persists a "you were mentioned" notification linked to the
|
||||
// post. Unlike likes there's no aggregation — a mention is a deliberate,
|
||||
// low-volume event.
|
||||
func (r *NotificationRepo) CreateMention(ctx context.Context, userID, actorID, postID string) error {
|
||||
if _, err := r.pg.Pool.Exec(ctx,
|
||||
`INSERT INTO notifications (user_id, actor_id, kind, post_id)
|
||||
VALUES ($1, $2, 'post_mention', $3)`,
|
||||
userID, actorID, postID,
|
||||
); err != nil {
|
||||
return fmt.Errorf("create mention notification: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// LikeEmailsEnabled reports whether the user wants aggregated like emails.
|
||||
func (r *NotificationRepo) LikeEmailsEnabled(ctx context.Context, userID string) (bool, error) {
|
||||
var enabled bool
|
||||
|
||||
Reference in New Issue
Block a user