♻️ Refactored fediverse relationships

This commit is contained in:
2025-12-31 18:29:35 +08:00
parent 2b6cf503a5
commit caf5468dad
9 changed files with 2437 additions and 42 deletions

View File

@@ -129,13 +129,11 @@ public class ActivityPubActivityProcessor(
{
ActorId = actor.Id,
TargetActorId = localActor.Id,
State = RelationshipState.Pending,
IsFollowing = false,
IsFollowedBy = true
State = RelationshipState.Pending
};
db.FediverseRelationships.Add(existingRelationship);
logger.LogInformation("Created new follow relationship. ActorId: {ActorId}, TargetActorId: {TargetActorId}",
actor.Id, actor.Id);
logger.LogInformation("Created new follow relationship. ActorId: {ActorId}, TargetActorId: {TargetActorId}",
actor.Id, localActor.Id);
}
else
{
@@ -184,8 +182,6 @@ public class ActivityPubActivityProcessor(
ActorId = localActor.Id,
TargetActorId = actor.Id,
State = RelationshipState.Accepted,
IsFollowing = true,
IsFollowedBy = false,
FollowedAt = SystemClock.Instance.GetCurrentInstant()
};
db.FediverseRelationships.Add(relationship);
@@ -193,7 +189,6 @@ public class ActivityPubActivityProcessor(
else
{
relationship.State = RelationshipState.Accepted;
relationship.IsFollowing = true;
relationship.FollowedAt = SystemClock.Instance.GetCurrentInstant();
}
@@ -222,7 +217,6 @@ public class ActivityPubActivityProcessor(
}
relationship.State = RelationshipState.Rejected;
relationship.IsFollowing = false;
relationship.RejectReason = "Remote rejected follow";
await db.SaveChangesAsync();