summaryrefslogtreecommitdiff
path: root/internal/processing/workers/fromfediapi.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/workers/fromfediapi.go')
-rw-r--r--internal/processing/workers/fromfediapi.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/processing/workers/fromfediapi.go b/internal/processing/workers/fromfediapi.go
index b64b8bbec..f6feeb622 100644
--- a/internal/processing/workers/fromfediapi.go
+++ b/internal/processing/workers/fromfediapi.go
@@ -1548,6 +1548,20 @@ func (p *fediAPI) UndoFollow(ctx context.Context, fMsg *messages.FromFediAPI) er
return gtserror.Newf("%T not parseable as *gtsmodel.Follow", fMsg.GTSModel)
}
+ // Clear any notifications that were
+ // generated by this follow (request).
+ if err := p.state.DB.DeleteNotifications(
+ ctx,
+ []gtsmodel.NotificationType{
+ gtsmodel.NotificationFollow,
+ gtsmodel.NotificationFollowRequest,
+ },
+ follow.TargetAccountID,
+ follow.AccountID,
+ ); err != nil {
+ return gtserror.Newf("db error deleting notifications: %w", err)
+ }
+
if follow.Account.IsLocal() {
// Remove posts by target from origin's timelines.
p.surface.removeRelationshipFromTimelines(ctx,