mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-07 13:58:06 -06:00
[feature] Receive notification when followed account posts (if desired) (#1680)
* start working on notifs for new posts * tidy up a bit * update swagger * carry over show reblogs + notify from follow req * test notify on status post * update column slice * dedupe update logic + add tests * fix own boosts not being timelined * avoid type check, passing unnecessary accounts * remove unnecessary 'inReplyToID' check * add a couple todo's for future db functions
This commit is contained in:
parent
c01d2f9b44
commit
093cf2ab12
17 changed files with 788 additions and 448 deletions
|
|
@ -48,6 +48,31 @@ func (n *notificationDB) GetNotificationByID(ctx context.Context, id string) (*g
|
|||
}, id)
|
||||
}
|
||||
|
||||
func (n *notificationDB) GetNotification(
|
||||
ctx context.Context,
|
||||
notificationType gtsmodel.NotificationType,
|
||||
targetAccountID string,
|
||||
originAccountID string,
|
||||
statusID string,
|
||||
) (*gtsmodel.Notification, db.Error) {
|
||||
return n.state.Caches.GTS.Notification().Load("NotificationType.TargetAccountID.OriginAccountID.StatusID", func() (*gtsmodel.Notification, error) {
|
||||
var notif gtsmodel.Notification
|
||||
|
||||
q := n.conn.NewSelect().
|
||||
Model(¬if).
|
||||
Where("? = ?", bun.Ident("notification_type"), notificationType).
|
||||
Where("? = ?", bun.Ident("target_account_id"), targetAccountID).
|
||||
Where("? = ?", bun.Ident("origin_account_id"), originAccountID).
|
||||
Where("? = ?", bun.Ident("status_id"), statusID)
|
||||
|
||||
if err := q.Scan(ctx); err != nil {
|
||||
return nil, n.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
return ¬if, nil
|
||||
}, notificationType, targetAccountID, originAccountID, statusID)
|
||||
}
|
||||
|
||||
func (n *notificationDB) GetAccountNotifications(ctx context.Context, accountID string, excludeTypes []string, limit int, maxID string, sinceID string) ([]*gtsmodel.Notification, db.Error) {
|
||||
// Ensure reasonable
|
||||
if limit < 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue