Include custom serializers on all relationships
This commit is contained in:
parent
8b972a577e
commit
69ef967050
|
@ -39,6 +39,22 @@ class UserRelationship(BookWyrmModel):
|
||||||
base_path = self.user_subject.remote_id
|
base_path = self.user_subject.remote_id
|
||||||
return '%s#%s/%d' % (base_path, self.status, self.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):
|
class UserFollows(UserRelationship):
|
||||||
''' Following a user '''
|
''' Following a user '''
|
||||||
|
@ -66,22 +82,6 @@ class UserFollowRequest(UserRelationship):
|
||||||
object=self.user_object.remote_id,
|
object=self.user_object.remote_id,
|
||||||
).serialize()
|
).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):
|
class UserBlocks(UserRelationship):
|
||||||
''' prevent another user from following you and seeing your posts '''
|
''' prevent another user from following you and seeing your posts '''
|
||||||
|
|
Loading…
Reference in New Issue