From 145b5db9474e32ca3430fe35eaa7498d7f26ff95 Mon Sep 17 00:00:00 2001 From: winter Date: Sun, 16 Mar 2025 00:53:52 +0000 Subject: implement poking and such --- routes/actor_profile_fragment.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'routes/actor_profile_fragment.php') diff --git a/routes/actor_profile_fragment.php b/routes/actor_profile_fragment.php index d189f87..65f7a49 100644 --- a/routes/actor_profile_fragment.php +++ b/routes/actor_profile_fragment.php @@ -1,9 +1,11 @@ mount('/fragment/actor/:id/blockButton', function (array render_template('actor/profile_block_button', ['user' => $user, 'actor' => $actor]); }); +Router::getInstance()->mount('/fragment/actor/:id/poke', function (array $args) { + $user = UserAccount::requireByCurrentSession(); + $actor = Actor::find($args['id']); + + if (!$actor->isPokeable()) { + throw new Forbidden("can't poke that user"); + } + $user->actor->poke($actor, PokeVerb::from($_POST['verb']), isset($_POST['urgent'])); + + render_template('actor/profile_poke_form', ['actor' => $actor, 'poked' => true]); +}); + Router::getInstance()->mount('/fragment/profile', function (array $args) { $user = UserAccount::requireByCurrentSession(); $actor = $user->actor; -- cgit v1.3