diff options
| author | winter | 2025-01-27 20:34:41 +0000 |
|---|---|---|
| committer | winter | 2025-01-27 20:34:41 +0000 |
| commit | 78536f774cacece20c22c1b26a7c4840d9e10794 (patch) | |
| tree | 8cc1c4de353f91948b725e996bf16c7fb359bc26 | |
| parent | df201664df01d5b4ada6b992235f236511ec020f (diff) | |
allow changing scope of replies
| -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 |
