From d9bf17761d6b770e8e56c642a8fa0f8e460a662f Mon Sep 17 00:00:00 2001 From: jade (winter) Date: Sat, 9 May 2026 15:50:43 +0100 Subject: add rudimentary language option and improve reply scope stuff --- locale/en_GB.json | 3 ++- locale/fr_FR.json | 3 ++- locale/nl_NL.json | 3 ++- routes/note_fragment.php | 10 +++++++--- templates/note/reply_form.php | 37 ++++++++++++++++++++++++++----------- templates/note/write_form.php | 7 ++++++- 6 files changed, 45 insertions(+), 18 deletions(-) diff --git a/locale/en_GB.json b/locale/en_GB.json index d2b3509..6ec3f6b 100644 --- a/locale/en_GB.json +++ b/locale/en_GB.json @@ -223,5 +223,6 @@ "form.edit": "Edit", "form.saveChanges": "Save", "form.discardChanges": "Cancel", - "form.saved": "Saved!" + "form.saved": "Saved!", + "misc.language": "Language" } diff --git a/locale/fr_FR.json b/locale/fr_FR.json index 0ff148b..c5a09c4 100644 --- a/locale/fr_FR.json +++ b/locale/fr_FR.json @@ -97,5 +97,6 @@ "writeNote.summary.label": "Avertissement de contenu (optionnel)", "writeReply.action": "Répondre", "writeReply.label": "Écriver une réponse", - "writeReply.placeholder": "Qu'est-ce que tu penses de ça ?" + "writeReply.placeholder": "Qu'est-ce que tu penses de ça ?", + "misc.language": "Langue" } diff --git a/locale/nl_NL.json b/locale/nl_NL.json index 123e781..ef7be0d 100644 --- a/locale/nl_NL.json +++ b/locale/nl_NL.json @@ -224,5 +224,6 @@ "writeNote.summary.label": "Inhoudswaarschuwing (optioneel)", "writeReply.action": "Reageren", "writeReply.label": "Schrijf een reactie", - "writeReply.placeholder": "Wat vind je hiervan?" + "writeReply.placeholder": "Wat vind je hiervan?", + "misc.language": "Taal" } diff --git a/routes/note_fragment.php b/routes/note_fragment.php index 76ef4b7..73702fe 100644 --- a/routes/note_fragment.php +++ b/routes/note_fragment.php @@ -99,11 +99,15 @@ Router::getInstance()->mount('/fragment/note/:id/reply', function (array $args) $reply = Note::create( $author->actor, CommonMark::getInstance()->renderToPlainText($content), - get_ui_language(), // TODO: actual language selector/detection + $_POST['language'] ?? $note->language, $summary, NotePrivacyScope::from($_POST['scope']), (new UserSettings($author))->getBool('noteDefaults.indexable') ); + $interactors = NotePrivacyInteractors::from($_POST['interactors']); + $note->privacy->canReply = $interactors; + $note->privacy->canReshare = $interactors; + $note->privacy->canOtherInteract = $interactors; $reply->formattedContent = [ 'text/markdown' => $content, 'text/html' => CommonMark::getInstance()->renderToHtml($content) @@ -173,7 +177,7 @@ Router::getInstance()->mount('/fragment/note', function (array $args) { $note = Note::create( $author->actor, CommonMark::getInstance()->renderToPlainText($content), - get_ui_language(), // TODO: actual language selector/detection + $_POST['language'] ?? get_ui_language(), $summary, NotePrivacyScope::from($_POST['scope']), (new UserSettings($author))->getBool('noteDefaults.indexable') @@ -241,4 +245,4 @@ Router::getInstance()->mount('/fragment/note/attachmentPill', function (array $a 'href' => $obj->getUrl() ]); } -}); \ No newline at end of file +}); diff --git a/templates/note/reply_form.php b/templates/note/reply_form.php index 1f84133..37b24b0 100644 --- a/templates/note/reply_form.php +++ b/templates/note/reply_form.php @@ -14,12 +14,13 @@ if ($note->summary) { } $scopeOptions = match ($note->privacy->scope) { - NotePrivacyScope::NONE => ['none'], - NotePrivacyScope::MUTUALS => ['none', 'mutuals'], - NotePrivacyScope::FOLLOWERS => ['none', 'mutuals', 'followers'], - default => ['none', 'mutuals', 'followers', 'public'] + 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; ?>
- - autocomplete="off"> + - + +
+ + 'person-off', 'mutuals' => 'group', 'followers' => 'groups', 'all' => 'select-all'] as $group => $icon): ?> + autocomplete="off"> + + +
+ +
+ +
diff --git a/templates/note/write_form.php b/templates/note/write_form.php index abd916c..d6178fa 100644 --- a/templates/note/write_form.php +++ b/templates/note/write_form.php @@ -58,8 +58,13 @@
+
+ + +
-
\ No newline at end of file + -- cgit v1.3