diff options
| author | winter | 2025-01-18 16:33:25 +0000 |
|---|---|---|
| committer | winter | 2025-01-18 16:33:25 +0000 |
| commit | c11c5064019f96d704cf324c8ee8580dd9e0d594 (patch) | |
| tree | 1b1f47bdbc76f54062f0f7dff8bc0be077ad202f /templates/note.php | |
| parent | 57f3f83a01c42b702005990bfc109367ffcf5f66 (diff) | |
disable note actions when logged out
Diffstat (limited to 'templates/note.php')
| -rw-r--r-- | templates/note.php | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/templates/note.php b/templates/note.php index 59f4a7a..98581c8 100644 --- a/templates/note.php +++ b/templates/note.php @@ -5,16 +5,20 @@ use Digitigrade\Model\UserAccount; $user = UserAccount::findByCurrentSession(); $interKinds = []; +$actionsDisabled = $user == null; if ($user != null) { $interactions = $note->getInteractionsWithAuthor($user->actor); $interKinds = array_map(fn($inter) => $inter->kind, $interactions); } ?> <article class="note <?= ($selected ?? false) ? 'selected' : '' ?>"> + <a href="/@/<?= $note->author->getFullHandle() ?>"> <?php call_template('actor_avatar', ['actor' => $note->author]); ?> </a> + <div> + <div class="infoLine"> <a class="authorName" href="/@/<?= $note->author->getFullHandle() ?>"><?= $note->author->displayName ?></a> <span class="authorHandle">@<?= $note->author->getFullHandle() ?></span> @@ -32,22 +36,24 @@ if ($user != null) { NotePrivacyScope::MUTUALS => __('note.privacy.scope.mutuals'), NotePrivacyScope::FOLLOWERS => __('note.privacy.scope.followers'), NotePrivacyScope::PUBLIC => __('note.privacy.scope.public') - } . '">' . match ($note->privacy->scope) { - NotePrivacyScope::NONE => 'lock', - NotePrivacyScope::MUTUALS => 'group', - NotePrivacyScope::FOLLOWERS => 'groups', - NotePrivacyScope::PUBLIC => 'public' - } ?></span> + } ?>"><?= match ($note->privacy->scope) { + NotePrivacyScope::NONE => 'lock', + NotePrivacyScope::MUTUALS => 'group', + NotePrivacyScope::FOLLOWERS => 'groups', + NotePrivacyScope::PUBLIC => 'public' + } ?></span> </div> + <?php if (isset($note->inReplyTo)): ?> - <div class=" replyInfo"> - <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>"> - <span class="material-symbols-outlined inlineIcon">reply</span> - <?= sprintf(__('note.info.replyTo'), - '<b>' . $note->inReplyTo->author->displayName) . '</b>' ?> - </a> + <div class="replyInfo"> + <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>"> + <span class="material-symbols-outlined inlineIcon">reply</span> + <?= sprintf(__('note.info.replyTo'), + '<b>' . $note->inReplyTo->author->displayName) . '</b>' ?> + </a> </div> <?php endif; ?> + <div class="content"> <?php if (isset($note->summary)): ?> <details> @@ -58,6 +64,7 @@ if ($user != null) { </details> <?php endif; ?> </div> + <div class="buttons"> <?php foreach (['like', 'dislike', 'reshare'] as $action) { $kind = InteractionKind::from($action); @@ -65,12 +72,18 @@ if ($user != null) { 'action' => $action, 'note' => $note, 'active' => in_array($kind, $interKinds), - 'count' => $note->countInteractionsOfKind($kind) + 'count' => $note->countInteractionsOfKind($kind), + 'disabled' => $actionsDisabled ]); } - call_template('reply_button', ['note' => $note, 'count' => $note->countReplies()]); + call_template('reply_button', [ + 'note' => $note, + 'count' => $note->countReplies(), + 'disabled' => $actionsDisabled + ]); ?> </div> + <?php call_template('reply_form', ['note' => $note]); ?> </div> </article>
\ No newline at end of file |
