aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/note/note.php
diff options
context:
space:
mode:
authorwinter2025-03-30 19:00:19 +0100
committerwinter2025-03-30 19:00:19 +0100
commitcd10f94269d7dcdd93df9fcda142a1e5a4441ae9 (patch)
tree75a00ef94c94259d3e6308d67e491b3800b47d89 /templates/note/note.php
parentc26a1dca22fcced7b9cd37ace7a20ae71491fd66 (diff)
implement basic interaction controls
Diffstat (limited to 'templates/note/note.php')
-rw-r--r--templates/note/note.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/templates/note/note.php b/templates/note/note.php
index 94f4895..ddc2bac 100644
--- a/templates/note/note.php
+++ b/templates/note/note.php
@@ -11,7 +11,6 @@ $MAX_PREVIEW_CARDS = 1;
$user = UserAccount::findByCurrentSession();
$prefs = $user ? new UserSettings($user) : null;
$interKinds = [];
-$actionsDisabled = $user == null;
if ($user != null) {
$interactions = $note->getInteractionsWithAuthor($user->actor);
$interKinds = array_map(fn($inter) => $inter->kind, $interactions);
@@ -98,18 +97,18 @@ if ($user != null) {
<div class="buttons">
<?php foreach (['like', 'dislike', 'reshare'] as $action) {
$kind = InteractionKind::from($action);
- call_template('interaction_button', [
+ call_template('note/interaction_button', [
'action' => $action,
'note' => $note,
'active' => in_array($kind, $interKinds),
'count' => $note->countInteractionsOfKind($kind),
- 'disabled' => $actionsDisabled
+ 'disabled' => !$note->isInteractibleBy($action, $user)
]);
}
call_template('note/reply_button', [
'note' => $note,
'count' => $note->countReplies(),
- 'disabled' => $actionsDisabled
+ 'disabled' => !$note->isInteractibleBy('reply', $user)
]);
?>
<div class="right">