diff options
| author | winter | 2025-03-30 19:18:51 +0100 |
|---|---|---|
| committer | winter | 2025-03-30 19:18:51 +0100 |
| commit | b5ec7311ef03232099dd3f8b30298738e1d0937e (patch) | |
| tree | 2b880f4828c1b4aebc311c1accb84c9f8b3692ae | |
| parent | cd10f94269d7dcdd93df9fcda142a1e5a4441ae9 (diff) | |
allow changing indexable setting
| -rwxr-xr-x | bin/migrate | 10 | ||||
| -rw-r--r-- | locale/en_GB.json | 2 | ||||
| -rw-r--r-- | routes/note_fragment.php | 8 | ||||
| -rw-r--r-- | routes/preferences.php | 1 | ||||
| -rw-r--r-- | settings.user.ini | 4 | ||||
| -rw-r--r-- | templates/preferences_form.php | 1 |
6 files changed, 22 insertions, 4 deletions
diff --git a/bin/migrate b/bin/migrate index fad88ff..360b10f 100755 --- a/bin/migrate +++ b/bin/migrate @@ -8,4 +8,12 @@ foreach (glob(__DIR__ . '/../migrations/*.php') as $file) { } \Digitigrade\Db\Migrator::getInstance()->migrate(); -\Digitigrade\GlobalSettings::getInstance()->mergeUpdates();
\ No newline at end of file +error_log('merging global settings'); +\Digitigrade\GlobalSettings::getInstance()->mergeUpdates(); +foreach (\Digitigrade\Model\UserAccount::findAll() as $user) { + /** @var \Digitigrade\Model\UserAccount $user */ + error_log('merging user settings for "' . $user->actor->displayName . '"'); + (new \Digitigrade\UserSettings($user))->mergeUpdates(); +} + +error_log('done!');
\ No newline at end of file diff --git a/locale/en_GB.json b/locale/en_GB.json index e076eed..8c6c2a4 100644 --- a/locale/en_GB.json +++ b/locale/en_GB.json @@ -160,6 +160,8 @@ "preferences.rssEnabled.description": "Provides a feed of your public notes, usable with common feed reader apps and online aggregators", "preferences.pokeable.name": "Allow others to poke you", "preferences.pokeable.description": "Also includes other verbs such as bite, wave at, hug, etc.", + "preferences.notesIndexable.name": "Allow search engines to index your notes", + "preferences.notesIndexable.description": "Doesn't apply to existing notes, only new ones", "changePassword.heading": "Change password", "changePassword.currentPassword": "Current password", "changePassword.newPassword": "New password", diff --git a/routes/note_fragment.php b/routes/note_fragment.php index 3d3c658..ff9559c 100644 --- a/routes/note_fragment.php +++ b/routes/note_fragment.php @@ -11,13 +11,13 @@ use Digitigrade\Model\Note; use Digitigrade\Model\NoteAttachment; use Digitigrade\Model\NotePrivacyInteractors; use Digitigrade\Model\NotePrivacyScope; -use Digitigrade\Model\Notification; use Digitigrade\Model\StorageObject; use Digitigrade\Model\UserAccount; use Digitigrade\Notification\AdminEditedNoteNotif; use Digitigrade\PolicyManager; use Digitigrade\Router; use Digitigrade\StorageProvider\FilesystemStorage; +use Digitigrade\UserSettings; Router::getInstance()->mount('/fragment/note/:id', function (array $args) { $note = Note::find($args['id']); @@ -101,7 +101,8 @@ Router::getInstance()->mount('/fragment/note/:id/reply', function (array $args) CommonMark::getInstance()->renderToPlainText($content), get_ui_language(), // TODO: actual language selector/detection $summary, - NotePrivacyScope::from($_POST['scope']) + NotePrivacyScope::from($_POST['scope']), + (new UserSettings($author))->getBool('noteDefaults.indexable') ); $reply->formattedContent = [ 'text/markdown' => $content, @@ -171,7 +172,8 @@ Router::getInstance()->mount('/fragment/note', function (array $args) { CommonMark::getInstance()->renderToPlainText($content), get_ui_language(), // TODO: actual language selector/detection $summary, - NotePrivacyScope::from($_POST['scope']) + NotePrivacyScope::from($_POST['scope']), + (new UserSettings($author))->getBool('noteDefaults.indexable') ); $interactors = NotePrivacyInteractors::from($_POST['interactors']); $note->privacy->canReply = $interactors; diff --git a/routes/preferences.php b/routes/preferences.php index 8ccf74e..40e41fd 100644 --- a/routes/preferences.php +++ b/routes/preferences.php @@ -21,6 +21,7 @@ Router::getInstance()->mount('/fragment/preferences', function (array $args) { $settings->set('interface.smallUnreadIndicators', $_POST['smallIndicators']); $settings->set('locale.timezone', $_POST['timezone']); $settings->set('profile.rssEnabled', $_POST['rssEnabled']); + $settings->set('noteDefaults.indexable', $_POST['notesIndexable']); $saved = true; } diff --git a/settings.user.ini b/settings.user.ini index 8725114..1b948f6 100644 --- a/settings.user.ini +++ b/settings.user.ini @@ -11,4 +11,8 @@ type = "timezone" [profile.rssEnabled] default = "false" +type = "boolean" + +[noteDefaults.indexable] +default = "true" type = "boolean"
\ No newline at end of file diff --git a/templates/preferences_form.php b/templates/preferences_form.php index ed13731..97a2900 100644 --- a/templates/preferences_form.php +++ b/templates/preferences_form.php @@ -24,6 +24,7 @@ function _user_pref(string $id, mixed $value, string $type) { _user_pref('timezone', $settings->get('locale.timezone'), 'timezone'); _user_pref('rssEnabled', $settings->getBool('profile.rssEnabled'), 'boolean'); _user_pref('pokeable', $user->actor->isPokeable(), 'boolean'); + _user_pref('notesIndexable', $settings->getBool('noteDefaults.indexable'), 'boolean'); ?> <div class="row"> |
