diff --git a/fedireads/incoming.py b/fedireads/incoming.py index bb1d0771..40c2deb5 100644 --- a/fedireads/incoming.py +++ b/fedireads/incoming.py @@ -201,8 +201,8 @@ def handle_incoming_follow(activity): # TODO: allow users to manually approve requests try: models.UserRelationship.objects.create( - user_subject=to_follow, - user_object=user, + user_subject=user, + user_object=to_follow, status='follow_request', relationship_id=activity['id'] ) diff --git a/fedireads/models/user.py b/fedireads/models/user.py index f3289003..292a7906 100644 --- a/fedireads/models/user.py +++ b/fedireads/models/user.py @@ -38,7 +38,7 @@ class User(AbstractUser): 'self', symmetrical=False, through='UserRelationship', - through_fields=('user_subject', 'user_object'), + through_fields=('user_object', 'user_subject'), related_name='following' ) favorites = models.ManyToManyField( diff --git a/fedireads/outgoing.py b/fedireads/outgoing.py index e1a9c510..f91975ff 100644 --- a/fedireads/outgoing.py +++ b/fedireads/outgoing.py @@ -88,8 +88,8 @@ def handle_outgoing_follow(user, to_follow): def handle_outgoing_unfollow(user, to_unfollow): ''' someone local wants to follow someone ''' relationship = models.UserRelationship.objects.get( - user_object=user, - user_subject=to_unfollow + user_subject=user, + user_object=to_unfollow ) activity = activitypub.get_unfollow(relationship) errors = broadcast(user, activity, [to_unfollow.inbox])