diff options
| author | winter | 2025-01-14 18:13:57 +0000 |
|---|---|---|
| committer | winter | 2025-01-14 18:13:57 +0000 |
| commit | 25b748f04911262826d0a0bc9609e03ee47c3232 (patch) | |
| tree | 35dc82bd0cb1798913f726fb6bb74be97e5b83ba /routes/note_fragment.php | |
| parent | 2082bfe9a378a90b33d4ab5c05dbb19a3457bef6 (diff) | |
add interaction counters
Diffstat (limited to 'routes/note_fragment.php')
| -rw-r--r-- | routes/note_fragment.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/routes/note_fragment.php b/routes/note_fragment.php index 53fd7af..a992a61 100644 --- a/routes/note_fragment.php +++ b/routes/note_fragment.php @@ -20,8 +20,8 @@ Router::getInstance()->mount('/fragment/note/:id/:action', function (array $args if ($interaction == null) { // we are adding a new interaction - $newint = Interaction::create($user->actor, InteractionKind::from($action), $note); - $newint->publish(); + $interaction = Interaction::create($user->actor, InteractionKind::from($action), $note); + $interaction->publish(); $active = true; } else { // we are removing the existing one @@ -29,7 +29,12 @@ Router::getInstance()->mount('/fragment/note/:id/:action', function (array $args $active = false; } - render_template('interaction_button', ['action' => $args['action'], 'active' => $active, 'note' => $note]); + render_template('interaction_button', [ + 'action' => $args['action'], + 'active' => $active, + 'note' => $note, + 'count' => $note->countInteractionsOfKind($interaction->kind) + ]); }); Router::getInstance()->mount('/fragment/note/:id/reply', function (array $args) { |
