Allow removing followers and fix follow rejections
* adds the ability to remove a user from your followers list * fixes verbs.Reject to process reject activities for previously accepted follows in both directions fixes #2635
This commit is contained in:
parent
06568aab88
commit
2ba0e3d7ff
9 changed files with 120 additions and 21 deletions
|
@ -171,8 +171,36 @@ class Reject(Verb):
|
|||
type: str = "Reject"
|
||||
|
||||
def action(self, allow_external_connections=True):
|
||||
"""reject a follow request"""
|
||||
obj = self.object.to_model(save=False, allow_create=False)
|
||||
"""reject a follow or follow request"""
|
||||
|
||||
if self.object.type == "Follow":
|
||||
model = apps.get_model("bookwyrm.UserFollowRequest")
|
||||
obj = self.object.to_model(
|
||||
model=model,
|
||||
save=False,
|
||||
allow_create=False,
|
||||
allow_external_connections=allow_external_connections,
|
||||
)
|
||||
if not obj:
|
||||
# This is a deletion (soft-block) of an accepted follow
|
||||
model = apps.get_model("bookwyrm.UserFollows")
|
||||
obj = self.object.to_model(
|
||||
model=model,
|
||||
save=False,
|
||||
allow_create=False,
|
||||
allow_external_connections=allow_external_connections,
|
||||
)
|
||||
else:
|
||||
# it's something else
|
||||
obj = self.object.to_model(
|
||||
model=model,
|
||||
save=False,
|
||||
allow_create=False,
|
||||
allow_external_connections=allow_external_connections,
|
||||
)
|
||||
if not obj:
|
||||
# if we don't have the object, we can't reject it.
|
||||
return
|
||||
obj.reject()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue