diff options
| -rw-r--r-- | routes/note_fragment.php | 2 | ||||
| -rw-r--r-- | static/form.css | 3 | ||||
| -rw-r--r-- | templates/reply_form.php | 19 |
3 files changed, 22 insertions, 2 deletions
diff --git a/routes/note_fragment.php b/routes/note_fragment.php index 5c6326d..143697f 100644 --- a/routes/note_fragment.php +++ b/routes/note_fragment.php @@ -69,7 +69,7 @@ Router::getInstance()->mount('/fragment/note/:id/reply', function (array $args) trim($_POST['content']), 'unk', $summary, - $note->privacy->scope + NotePrivacyScope::from($_POST['scope']) ); $reply->inReplyTo = $note; $reply->threadApex = $note->threadApex ?? $note; diff --git a/static/form.css b/static/form.css index 4683929..c14b0b7 100644 --- a/static/form.css +++ b/static/form.css @@ -53,7 +53,8 @@ form:not(.nopanel):not([hidden]) { max-width: 100%; input:not([type="checkbox"]), textarea, - button { + button, + select { width: 100%; box-sizing: border-box; } diff --git a/templates/reply_form.php b/templates/reply_form.php index 915189e..1b9961e 100644 --- a/templates/reply_form.php +++ b/templates/reply_form.php @@ -1,4 +1,5 @@ <?php +use Digitigrade\Model\NotePrivacyScope; use Digitigrade\Model\UserAccount; $user = UserAccount::findByCurrentSession(); @@ -11,6 +12,14 @@ if ($note->summary) { $summaryText = "re: $note->summary"; } } + +$scopeOptions = match ($note->privacy->scope) { + NotePrivacyScope::NONE => ['none'], + NotePrivacyScope::MUTUALS => ['none', 'mutuals'], + NotePrivacyScope::FOLLOWERS => ['none', 'mutuals', 'followers'], + default => ['none', 'mutuals', 'followers', 'public'] +}; +$selectedScope = $note->privacy->scope->value; ?> <form class="noteReplyForm" id="replyForm-<?= $note->id ?>" _="on submit send toggle to previous <button.reply/> then wait 1s then trigger update on #liveTimelineUpdater on toggle or submit toggle @hidden" @@ -34,6 +43,16 @@ if ($note->summary) { <?php call_template('user_mention_pill'); ?> </div> <div class="row"> + <label for="replyScope-<?= $note->id ?>"><?= __('writeNote.scope.label') ?></label> + <select name="scope" id="replyScope-<?= $note->id ?>" required autocomplete="off"> + <?php foreach ($scopeOptions as $s): ?> + <option value="<?= $s ?>" <?= $selectedScope == $s ? 'selected' : '' ?>> + <?= __("note.privacy.scope.$s") ?> + </option> + <?php endforeach; ?> + </select> + </div> + <div class="row"> <button class="primary"><?= __('writeReply.action') ?></button> </div> </form>
\ No newline at end of file |
