kopia lustrzana https://github.com/jointakahe/takahe
follow request: move ClearTimeline out of state loop to run a bit earlier and keep test happy
rodzic
78bd7b6708
commit
62c1aa16b2
|
@ -251,7 +251,8 @@ def test_clear_timeline(
|
|||
else:
|
||||
service.unfollow(remote_identity)
|
||||
|
||||
# Run stator once to process the timeline clear message
|
||||
# Run stator twice to process the timeline clear message
|
||||
stator.run_single_cycle()
|
||||
stator.run_single_cycle()
|
||||
|
||||
# Verify that the right things vanished
|
||||
|
|
|
@ -136,14 +136,6 @@ class FollowStates(StateGraph):
|
|||
|
||||
@classmethod
|
||||
def handle_pending_removal(cls, instance: "Follow"):
|
||||
if instance.source.local:
|
||||
InboxMessage.create_internal(
|
||||
{
|
||||
"type": "ClearTimeline",
|
||||
"object": instance.target.pk,
|
||||
"actor": instance.source.pk,
|
||||
}
|
||||
)
|
||||
if instance.target.local:
|
||||
from activities.models import TimelineEvent
|
||||
|
||||
|
@ -406,6 +398,15 @@ class Follow(StatorModel):
|
|||
# Ensure the Accept actor is the Follow's target
|
||||
if data["actor"] != follow.target.actor_uri:
|
||||
raise ValueError("Reject actor does not match its Follow object", data)
|
||||
# Clear timeline if remote target remove local source from their previously accepted follows
|
||||
if follow.accepted:
|
||||
InboxMessage.create_internal(
|
||||
{
|
||||
"type": "ClearTimeline",
|
||||
"object": follow.target.pk,
|
||||
"actor": follow.source.pk,
|
||||
}
|
||||
)
|
||||
# Mark the follow rejected
|
||||
follow.transition_perform(FollowStates.rejecting)
|
||||
|
||||
|
|
|
@ -121,6 +121,13 @@ class IdentityService:
|
|||
existing_follow = Follow.maybe_get(self.identity, target_identity)
|
||||
if existing_follow:
|
||||
existing_follow.transition_perform(FollowStates.undone)
|
||||
InboxMessage.create_internal(
|
||||
{
|
||||
"type": "ClearTimeline",
|
||||
"object": target_identity.pk,
|
||||
"actor": self.identity.pk,
|
||||
}
|
||||
)
|
||||
|
||||
def block(self, target_identity: Identity) -> Block:
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue