aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjade (winter)2026-05-09 15:50:43 +0100
committerjade (winter)2026-05-09 15:50:43 +0100
commitd9bf17761d6b770e8e56c642a8fa0f8e460a662f (patch)
treeea4352382dc2535162a98dd5f404c927248932a5
parente4a541e67fbd05a6bf657f95fdf221e702d50bae (diff)
add rudimentary language option and improve reply scope stuff
-rw-r--r--locale/en_GB.json3
-rw-r--r--locale/fr_FR.json3
-rw-r--r--locale/nl_NL.json3
-rw-r--r--routes/note_fragment.php10
-rw-r--r--templates/note/reply_form.php37
-rw-r--r--templates/note/write_form.php7
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;
?>
<form class="noteReplyForm" id="replyForm-<?= $note->id ?>" _="
on htmx:afterOnLoad if event.detail.elt is me
@@ -49,14 +50,28 @@ $selectedScope = $note->privacy->scope->value;
<?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>
+ <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; ?>
- </select>
+ </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">
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 @@
<label class="standalone"><?= __('writeNote.attachments.label') ?></label>
<?php call_template('note/attachment_pill'); ?>
</div>
+ <div class="row">
+ <label for="noteLanguage"><?= __('misc.language') ?></label>
+ <input type="text" id="noteLanguage" name="language"
+ value="<?= get_ui_language() ?>">
+ </div>
</details>
<div class="row">
<button class="primary" id="writeNoteSubmitButton"><?= __('writeNote.action') ?></button>
</div>
-</form> \ No newline at end of file
+</form>