diff --git a/bookwyrm/models/relationship.py b/bookwyrm/models/relationship.py index f3aca8bbb..e357955ec 100644 --- a/bookwyrm/models/relationship.py +++ b/bookwyrm/models/relationship.py @@ -39,6 +39,22 @@ class UserRelationship(BookWyrmModel): base_path = self.user_subject.remote_id return '%s#%s/%d' % (base_path, self.status, self.id) + def to_accept_activity(self): + ''' generate an Accept for this follow request ''' + return activitypub.Accept( + id='%s#accepts/follows/' % self.remote_id, + actor=self.user_subject.remote_id, + object=self.user_object.remote_id, + ).serialize() + + def to_reject_activity(self): + ''' generate an Accept for this follow request ''' + return activitypub.Reject( + id='%s#rejects/follows/' % self.remote_id, + actor=self.user_subject.remote_id, + object=self.user_object.remote_id, + ).serialize() + class UserFollows(UserRelationship): ''' Following a user ''' @@ -66,22 +82,6 @@ class UserFollowRequest(UserRelationship): object=self.user_object.remote_id, ).serialize() - def to_accept_activity(self): - ''' generate an Accept for this follow request ''' - return activitypub.Accept( - id='%s#accepts/follows/' % self.remote_id, - actor=self.user_subject.remote_id, - object=self.user_object.remote_id, - ).serialize() - - def to_reject_activity(self): - ''' generate an Accept for this follow request ''' - return activitypub.Reject( - id='%s#rejects/follows/' % self.remote_id, - actor=self.user_subject.remote_id, - object=self.user_object.remote_id, - ).serialize() - class UserBlocks(UserRelationship): ''' prevent another user from following you and seeing your posts '''