mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Fix unfollow
This commit is contained in:
parent
20a40ee344
commit
5ad4d81735
1 changed files with 4 additions and 11 deletions
|
@ -156,26 +156,19 @@ class MicroblogPubBackend(Backend):
|
|||
|
||||
@ensure_it_is_me
|
||||
def new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None:
|
||||
remote_actor = follow.get_actor().id
|
||||
|
||||
if DB.followers.find({"remote_actor": remote_actor}).count() == 0:
|
||||
DB.followers.insert_one({"remote_actor": remote_actor})
|
||||
pass
|
||||
|
||||
@ensure_it_is_me
|
||||
def undo_new_follower(self, as_actor: ap.Person, follow: ap.Follow) -> None:
|
||||
# TODO(tsileo): update the follow to set undo
|
||||
DB.followers.delete_one({"remote_actor": follow.get_actor().id})
|
||||
DB.activities.update_one({"remote_id": follow.id}, {"$set": {"meta.undo": True}})
|
||||
|
||||
@ensure_it_is_me
|
||||
def undo_new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None:
|
||||
# TODO(tsileo): update the follow to set undo
|
||||
DB.following.delete_one({"remote_actor": follow.get_object().id})
|
||||
DB.activities.update_one({"remote_id": follow.id}, {"$set": {"meta.undo": True}})
|
||||
|
||||
@ensure_it_is_me
|
||||
def new_following(self, as_actor: ap.Person, follow: ap.Follow) -> None:
|
||||
remote_actor = follow.get_object().id
|
||||
if DB.following.find({"remote_actor": remote_actor}).count() == 0:
|
||||
DB.following.insert_one({"remote_actor": remote_actor})
|
||||
pass
|
||||
|
||||
@ensure_it_is_me
|
||||
def inbox_like(self, as_actor: ap.Person, like: ap.Like) -> None:
|
||||
|
|
Loading…
Reference in a new issue