Fix unfollow

This commit is contained in:
Thomas Sileo 2018-07-07 14:11:23 +02:00
parent 20a40ee344
commit 5ad4d81735

View file

@ -156,26 +156,19 @@ class MicroblogPubBackend(Backend):
@ensure_it_is_me @ensure_it_is_me
def new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None: def new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None:
remote_actor = follow.get_actor().id pass
if DB.followers.find({"remote_actor": remote_actor}).count() == 0:
DB.followers.insert_one({"remote_actor": remote_actor})
@ensure_it_is_me @ensure_it_is_me
def undo_new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None: def undo_new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None:
# TODO(tsileo): update the follow to set undo DB.activities.update_one({"remote_id": follow.id}, {"$set": {"meta.undo": True}})
DB.followers.delete_one({"remote_actor": follow.get_actor().id})
@ensure_it_is_me @ensure_it_is_me
def undo_new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None: def undo_new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None:
# TODO(tsileo): update the follow to set undo DB.activities.update_one({"remote_id": follow.id}, {"$set": {"meta.undo": True}})
DB.following.delete_one({"remote_actor": follow.get_object().id})
@ensure_it_is_me @ensure_it_is_me
def new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None: def new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None:
remote_actor = follow.get_object().id pass
if DB.following.find({"remote_actor": remote_actor}).count() == 0:
DB.following.insert_one({"remote_actor": remote_actor})
@ensure_it_is_me @ensure_it_is_me
def inbox_like(self, as_actor: ap.Person, like: ap.Like) -> None: def inbox_like(self, as_actor: ap.Person, like: ap.Like) -> None: