diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/actor_profile.php | 4 | ||||
| -rw-r--r-- | templates/actor_profile_block_button.php | 7 | ||||
| -rw-r--r-- | templates/actor_profile_page.php | 2 | ||||
| -rw-r--r-- | templates/note_hidden.php | 3 | ||||
| -rw-r--r-- | templates/notifications_panel.php | 2 | ||||
| -rw-r--r-- | templates/thread_page.php | 8 |
6 files changed, 24 insertions, 2 deletions
diff --git a/templates/actor_profile.php b/templates/actor_profile.php index 2947a72..cfcc510 100644 --- a/templates/actor_profile.php +++ b/templates/actor_profile.php @@ -17,7 +17,9 @@ $user = UserAccount::findByCurrentSession(); <div class="handle">@<?= $actor->getFullHandle() ?></div> <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?></div> </div> - <div> + <div class="profileMiniActions"> + <?php if ($user != null && $user->actor != $actor) + call_template('actor_profile_block_button', ['actor' => $actor, 'user' => $user]); ?> <?php if (!$actor->isLocal): ?> <a class="material-symbols open-in-new" href="<?= $actor->homepage ?>" title="<?= __('user.profile.openRemote') ?>" target="_blank"></a> diff --git a/templates/actor_profile_block_button.php b/templates/actor_profile_block_button.php new file mode 100644 index 0000000..f82cc9a --- /dev/null +++ b/templates/actor_profile_block_button.php @@ -0,0 +1,7 @@ +<?php +$blocks = $user->actor->blocks($actor); +$action = $blocks ? 'unblock' : 'block'; +?> +<button class="material-symbols <?= $blocks ? 'remove' : 'block' ?>" title="<?= __("user.profile.$action") ?>" + hx-confirm="<?= __("user.profile.$action.confirm") ?>" hx-post="/fragment/actor/<?= $actor->id ?>/blockButton" + hx-swap="outerHTML"></button>
\ No newline at end of file diff --git a/templates/actor_profile_page.php b/templates/actor_profile_page.php index eba9d04..3b6eb84 100644 --- a/templates/actor_profile_page.php +++ b/templates/actor_profile_page.php @@ -15,6 +15,8 @@ call_template('skeleton', [ $notes = Note::findAllWithAuthor($actor, 20); if (count($notes) == 0) { call_template('placeholder_text', ['message' => __('user.notes.placeholder')]); + } elseif ($user != null && $user->actor->blocks($actor)) { + call_template('placeholder_text', ['message' => __('user.profile.notesHidden')]); } else { foreach ($notes as $n) { if ($n->isViewableBy($user)) diff --git a/templates/note_hidden.php b/templates/note_hidden.php new file mode 100644 index 0000000..baad0d6 --- /dev/null +++ b/templates/note_hidden.php @@ -0,0 +1,3 @@ +<article class="note hidden"> + <?php call_template('placeholder_text', ['message' => __('note.hidden')]); ?> +</article>
\ No newline at end of file diff --git a/templates/notifications_panel.php b/templates/notifications_panel.php index 3ca8faf..98a04e3 100644 --- a/templates/notifications_panel.php +++ b/templates/notifications_panel.php @@ -13,6 +13,8 @@ $notifications = Notification::findAllForUser($user, 50); } foreach ($notifications as $notif) { $notif = $notif->toNotifyable(); + if ($notif == null) + continue; call_template('notification', [ 'title' => $notif->getNotificationTitle(), 'body' => $notif->getNotificationBody(), diff --git a/templates/thread_page.php b/templates/thread_page.php index e5e5389..d16c6aa 100644 --- a/templates/thread_page.php +++ b/templates/thread_page.php @@ -1,5 +1,6 @@ <?php use Digitigrade\Model\Note; +use Digitigrade\Model\UserAccount; call_template('skeleton', [ 'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle(), @@ -7,7 +8,12 @@ call_template('skeleton', [ ], function () { global $note; $notes = Note::findAllInThread($note->threadApex ?? $note); + $user = UserAccount::findByCurrentSession(); foreach ($notes as $n) { - call_template('note', ['note' => $n, 'selected' => $n == $note]); + if ($user != null && $user->actor->blocks($n->author)) { + call_template('note_hidden'); + } else { + call_template('note', ['note' => $n, 'selected' => $n == $note]); + } } });
\ No newline at end of file |
