[backend/federation] Check for Instance.IsSuspended in PreDeliverQueue for ASFollow activities

We're not currently using that property, but we may in the future.
This commit is contained in:
Laura Hausmann 2024-06-19 18:37:43 +02:00
parent 9dbc7cfc14
commit eb167cf482
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -140,12 +140,13 @@ file static class QueryableExtensions
this IQueryable<InboxQueryResult> query, ASActivity activity, DatabaseContext db this IQueryable<InboxQueryResult> query, ASActivity activity, DatabaseContext db
) )
{ {
if (activity is ASFollow) return query; return activity is ASFollow
return query.Where(user => !db.Instances.Any(p => p.Host == user.Host && ? query.Where(user => !db.Instances.Any(p => p.Host == user.Host && p.IsSuspended))
((p.IsNotResponding && : query.Where(user => !db.Instances.Any(p => p.Host == user.Host &&
p.LastCommunicatedAt < ((p.IsNotResponding &&
DateTime.UtcNow - TimeSpan.FromDays(7)) || p.LastCommunicatedAt <
p.IsSuspended))); DateTime.UtcNow - TimeSpan.FromDays(7)) ||
p.IsSuspended)));
} }
public static IQueryable<InboxQueryResult> SkipBlockedInstances( public static IQueryable<InboxQueryResult> SkipBlockedInstances(