aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/note.php
diff options
context:
space:
mode:
authorwinter2025-02-16 20:09:16 +0000
committerwinter2025-02-16 20:09:16 +0000
commit645e8bd0b2cf5f020585047d683ed0b26e892204 (patch)
treefcf5b73eaf2041e39d439e3ead41c0ceff7da2d1 /templates/note.php
parent5a44137ddea7b3a6d7f68cbe71594f7633d6e9a6 (diff)
share button in context menus
Diffstat (limited to 'templates/note.php')
-rw-r--r--templates/note.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/templates/note.php b/templates/note.php
index 4cdcd94..19a1895 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -15,6 +15,7 @@ if ($user != null) {
$interactions = $note->getInteractionsWithAuthor($user->actor);
$interKinds = array_map(fn($inter) => $inter->kind, $interactions);
}
+$pathToSelf = '/@/' . $note->author->getFullHandle() . '/note/' . $note->id;
?>
<article class="note <?= ($selected ?? false) ? 'selected' : '' ?>">
@@ -33,8 +34,7 @@ if ($user != null) {
<?php endif; ?>
@<?= htmlspecialchars($note->author->getFullHandle()) ?>
</span>
- <a class="timestamp"
- href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>/note/<?= $note->id ?>">
+ <a class="timestamp" href="<?= htmlspecialchars($pathToSelf) ?>">
<?= format_datetime($note->created, $prefs?->get('locale.timezone'))
. (isset($note->modified) && $note->modified != $note->created
? ' (' . format_datetime($note->modified, $prefs?->get('locale.timezone')) . ')'
@@ -126,6 +126,17 @@ if ($user != null) {
global $note;
$user = UserAccount::findByCurrentSession();
?>
+ <li>
+ <button data-share-url="<?= htmlspecialchars($note->uri) ?>" _="
+ on click
+ set url to my @data-share-url
+ js(url)
+ navigator.share({ url: url })
+ end" type="button">
+ <span class="material-symbols share"></span>
+ <span><?= __('action.share') ?></span>
+ </button>
+ </li>
<?php if ($note->author->isLocal && ($note->author == $user?->actor || $user?->isAdmin)): ?>
<li>
<button hx-delete="/fragment/note/<?= $note->id ?>"
@@ -136,6 +147,14 @@ if ($user != null) {
</button>
</li>
<?php endif; ?>
+ <?php if (!$note->author->isLocal): ?>
+ <li>
+ <a target="_blank" href="<?= htmlspecialchars($note->uri) ?>" rel="nofollow noreferrer">
+ <span class="material-symbols open-in-new"></span>
+ <span><?= __('note.openRemote') ?></span>
+ </a>
+ </li>
+ <?php endif; ?>
<?php }); ?>
</div>
</div>