mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-29 19:40:32 +00:00
Include custom serializers on all relationships
This commit is contained in:
parent
8b972a577e
commit
69ef967050
1 changed files with 16 additions and 16 deletions
|
@ -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 '''
|
||||
|
|
Loading…
Reference in a new issue