Update follow and unfollow to use UserFollowRequest & UserFollows.

This commit is contained in:
Adam Kelly
2020-03-11 12:32:50 +00:00
parent e050704c2c
commit b21c5fc98f
4 changed files with 20 additions and 10 deletions

View File

@ -2,4 +2,4 @@
from .book import Book, Work, Edition, Author
from .shelf import Shelf, ShelfBook
from .status import Status, Review, Favorite, Tag, Notification
from .user import User, UserRelationship, FederatedServer
from .user import User, FederatedServer, UserFollows, UserFollowRequest, UserBlocks

View File

@ -109,6 +109,14 @@ class UserFollows(UserRelationship):
def status(self):
return 'follows'
@classmethod
def from_request(cls, follow_request):
return cls(
user_subject=follow_request.user_subject,
user_object=follow_request.user_object,
relationship_id=follow_request.relationship_id,
)
class UserFollowRequest(UserRelationship):
@property
def status(self):