1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
<?php
use Digitigrade\Model\NotePrivacyScope;
use Digitigrade\Model\UserAccount;
$user = UserAccount::findByCurrentSession();
$summaryText = '';
if ($note->summary) {
if (strtolower(substr($note->summary, 0, 3)) == 're:') {
$summaryText = $note->summary;
} else {
$summaryText = "re: $note->summary";
}
}
$scopeOptions = match ($note->privacy->scope) {
NotePrivacyScope::NONE => ['none' => 'lock'],
NotePrivacyScope::MUTUALS => ['none' => 'lock', 'mutuals' => 'group'],
NotePrivacyScope::FOLLOWERS => ['none' => 'lock', 'mutuals' => 'group', 'followers' => 'groups'],
default => ['none' => 'lock', 'mutuals' => 'group', 'followers' => 'groups', 'public' => 'public']
};
$selectedScope = $note->privacy->scope->value;
$selectedInteractors = $note->privacy->canReply->value;
?>
<form class="noteReplyForm" id="replyForm-<?= $note->id ?>" _="
on htmx:afterOnLoad if event.detail.elt is me
send toggle to [me, #interactButton-reply-<?= $note->id ?>]
trigger update on #liveTimelineUpdater
end
on toggle toggle @hidden" hidden hx-post="/fragment/note/<?= $note->id ?>/reply"
hx-disabled-elt="#replySubmitButton-<?= $note->id ?>" hx-swap="outerHTML" hx-target="this">
<div class="row summaryAndContent">
<label for="replyContent-<?= $note->id ?>"><?= __('writeReply.label') ?></label>
<input type="text" id="replySummary-<?= $note->id ?>" name="summary" autocomplete="off"
value="<?= htmlspecialchars($summaryText) ?>" placeholder="<?= __('writeNote.summary.label') ?>">
<textarea id="replyContent-<?= $note->id ?>" name="content" required autocomplete="off"
placeholder="<?= __('writeReply.placeholder') ?>"
_="on keydown[ctrlKey and key is 'Enter'] set b to #replySubmitButton-<?= $note->id ?> then b.click()"></textarea>
<?php call_template('formatting_hint'); ?>
</div>
<details>
<summary><?= __('writeNote.moreOptions') ?></summary>
<div class="row">
<label class="standalone"><?= __('writeNote.mentions.label') ?></label>
<?php foreach (array_merge($note->mentions, [$note->author]) as $m) {
if ($m != $user?->actor) {
call_template('user_mention_pill', ['type' => 'user', 'actor' => $m]);
}
} ?>
<?php call_template('user_mention_pill'); ?>
</div>
<div class="row">
<fieldset class="column noteScopeButtons">
<legend><?= __('writeNote.scope.label') ?></legend>
<?php foreach ($scopeOptions as $scope => $icon): ?>
<input type="radio" name="scope" value="<?= $scope ?>" id="replyScope-<?= $note->id ?>-<?= $scope ?>" <?= $scope == $selectedScope ? 'checked' : '' ?> autocomplete="off">
<label for="replyScope-<?= $note->id ?>-<?= $scope ?>" class="material-symbols <?= $icon ?>"
title="<?= __("note.privacy.scope.$scope") ?>"></label>
<?php endforeach; ?>
</fieldset>
<fieldset class="column noteInteractorButtons">
<legend><?= __('writeNote.interactors.label') ?></legend>
<?php foreach (['none' => 'person-off', 'mutuals' => 'group', 'followers' => 'groups', 'all' => 'select-all'] as $group => $icon): ?>
<input type="radio" name="interactors" value="<?= $group ?>" id="replyInteractors-<?= $note->id ?>-<?= $group ?>"
<?= $group == $selectedInteractors ? 'checked' : '' ?> autocomplete="off">
<label for="replyInteractors-<?= $note->id ?>-<?= $group ?>" class="material-symbols <?= $icon ?>"
title="<?= __("note.privacy.interactors.$group") ?>"></label>
<?php endforeach; ?>
</fieldset>
</div>
<div class="row">
<label for="replyLanguage-<?= $note->id ?>"><?= __('misc.language') ?></label>
<input type="text" id="replyLanguage-<?= $note->id ?>" name="language"
value="<?= $note->language ?? get_ui_language() ?>">
</div>
</details>
<div class="row">
<button class="primary" id="replySubmitButton-<?= $note->id ?>"><?= __('writeReply.action') ?></button>
</div>
</form>
|