kopia lustrzana https://github.com/tsileo/little-boxes
Working undo Like
rodzic
998eb90e71
commit
86da64f7a4
|
@ -797,7 +797,10 @@ class Announce(BaseActivity):
|
|||
BACKEND.outbox_undo_announce(as_actor, self)
|
||||
|
||||
def build_undo(self) -> BaseActivity:
|
||||
return Undo(object=self.to_dict(embed=True))
|
||||
return Undo(
|
||||
actor=self.get_actor().id,
|
||||
object=self.to_dict(embed=True),
|
||||
)
|
||||
|
||||
|
||||
class Delete(BaseActivity):
|
||||
|
|
|
@ -552,6 +552,65 @@ def test_little_boxes_follow_and_new_create_note_and_like():
|
|||
),
|
||||
)
|
||||
|
||||
return back, like
|
||||
|
||||
|
||||
def test_little_boxes_follow_and_new_create_note_and_like_and_undo_like():
|
||||
back, like = test_little_boxes_follow_and_new_create_note_and_like()
|
||||
|
||||
me = back.get_user("tom")
|
||||
other = back.get_user("tom2")
|
||||
|
||||
outbox = ap.Outbox(me)
|
||||
|
||||
undo = like.build_undo()
|
||||
outbox.post(undo)
|
||||
|
||||
back.assert_called_methods(
|
||||
me,
|
||||
(
|
||||
"an Undo activity is published",
|
||||
"outbox_new",
|
||||
lambda as_actor: _assert_eq(as_actor.id, me.id),
|
||||
lambda activity: _assert_eq(activity.id, undo.id),
|
||||
),
|
||||
(
|
||||
'"outbox_undo_like" hook is called',
|
||||
"outbox_undo_like",
|
||||
lambda as_actor: _assert_eq(as_actor.id, me.id),
|
||||
lambda _like: _assert_eq(_like.id, undo.get_object().id),
|
||||
),
|
||||
(
|
||||
"the Undo activity is posted to the original recipients",
|
||||
"post_to_remote_inbox",
|
||||
lambda as_actor: _assert_eq(as_actor.id, me.id),
|
||||
lambda payload: None,
|
||||
lambda recipient: _assert_eq(recipient, other.inbox),
|
||||
),
|
||||
)
|
||||
|
||||
back.assert_called_methods(
|
||||
other,
|
||||
(
|
||||
"receiving the Like, ensure we check the actor is not blocked",
|
||||
"outbox_is_blocked",
|
||||
lambda as_actor: _assert_eq(as_actor.id, other.id),
|
||||
lambda remote_actor: _assert_eq(remote_actor, me.id),
|
||||
),
|
||||
(
|
||||
"receiving the Undo activity",
|
||||
"inbox_new",
|
||||
lambda as_actor: _assert_eq(as_actor.id, other.id),
|
||||
lambda activity: _assert_eq(activity.id, undo.id),
|
||||
),
|
||||
(
|
||||
'"inbox_undo_like" hook is called',
|
||||
"inbox_undo_like",
|
||||
lambda as_actor: _assert_eq(as_actor.id, other.id),
|
||||
lambda _like: _assert_eq(_like.id, undo.get_object().id),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def test_little_boxes_follow_and_new_create_note_and_announce():
|
||||
back, create = test_little_boxes_follow_and_new_create_note()
|
||||
|
|
Ładowanie…
Reference in New Issue