aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/note.php
diff options
context:
space:
mode:
Diffstat (limited to 'templates/note.php')
-rw-r--r--templates/note.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/templates/note.php b/templates/note.php
index b43e63e..db4fbb9 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -3,8 +3,10 @@ use Digitigrade\Model\Actor;
use Digitigrade\Model\InteractionKind;
use Digitigrade\Model\NotePrivacyScope;
use Digitigrade\Model\UserAccount;
+use Digitigrade\UserSettings;
$user = UserAccount::findByCurrentSession();
+$prefs = $user ? new UserSettings($user) : null;
$interKinds = [];
$actionsDisabled = $user == null;
if ($user != null) {
@@ -25,13 +27,11 @@ if ($user != null) {
href="/@/<?= $note->author->getFullHandle() ?>"><?= htmlspecialchars($note->author->displayName) ?></a>
<span class="authorHandle">@<?= $note->author->getFullHandle() ?></span>
<a class="timestamp" href="/@/<?= $note->author->getFullHandle() ?>/note/<?= $note->id ?>">
- <?= // TODO: localise
- $note->created->format('Y-m-d \a\t H:i')
+ <?= format_datetime($note->created, $prefs?->get('locale.timezone'))
. (isset($note->modified) && $note->modified != $note->created
- ? ' (edited ' . $note->modified->format('Y-m-d \a\t H:i') . ')'
+ ? ' (' . format_datetime($note->modified, $prefs?->get('locale.timezone')) . ')'
: ''
- )
- ?>
+ ) ?>
</a>
<span class="privacyScope inlineIcon material-symbols <?= match ($note->privacy->scope) {
NotePrivacyScope::NONE => 'lock',
@@ -78,11 +78,11 @@ if ($user != null) {
<div class="attachments">
<?php foreach ($note->attachments as $attachment): ?>
<div>
- <?php if (str_starts_with($attachment->type, 'image/')): ?>
+ <?php if ($attachment->isImage()): ?>
<img src="<?= $attachment->href ?>" alt="<?= htmlspecialchars($attachment->description ?? '') ?>"
title="<?= htmlspecialchars($attachment->description ?? '') ?>">
<?php else: ?>
- <a class="file" href="<?= $attachment->href ?>" target="_blank">
+ <a class="file" href="<?= $attachment->href ?>" target="_blank" download>
<span class="material-symbols attach-file"></span>
<span><?= htmlspecialchars($attachment->description ?? basename($attachment->href)) ?></span>
</a>