Update Privacy Settings, add support for Mastodon indexable search flag

This commit is contained in:
Daniel Supernault 2023-08-24 23:31:33 -06:00
parent a3696dac95
commit fc24630eba
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
5 changed files with 64 additions and 15 deletions

View file

@ -39,9 +39,11 @@ trait PrivacySettings
'public_dm',
'show_profile_follower_count',
'show_profile_following_count',
'indexable',
'show_atom',
];
$profile->indexable = $request->input('indexable') == 'on';
$profile->is_suggestable = $request->input('is_suggestable') == 'on';
$profile->save();
@ -70,6 +72,8 @@ trait PrivacySettings
} else {
$settings->{$field} = false;
}
} elseif ($field == 'indexable') {
} else {
if ($form == 'on') {
$settings->{$field} = true;

View file

@ -16,6 +16,8 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'https://www.w3.org/ns/activitystreams',
[
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
'pixelfed' => 'http://pixelfed.org/ns#',
'schema' => 'http://schema.org/',
'alsoKnownAs' => [
'@id' => 'as:alsoKnownAs',
'@type' => '@id'
@ -23,6 +25,10 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'movedTo' => [
'@id' => 'as:movedTo',
'@type' => '@id'
],
'indexable' => [
'@id' => 'pixelfed:indexable',
'@type' => 'schema:Boolean'
]
],
],
@ -37,6 +43,7 @@ class ProfileTransformer extends Fractal\TransformerAbstract
'summary' => $profile->bio,
'url' => $profile->url(),
'manuallyApprovesFollowers' => (bool) $profile->is_private,
'indexable' => (bool) $profile->indexable,
'publicKey' => [
'id' => $profile->permalink().'#main-key',
'owner' => $profile->permalink(),

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('profiles', function (Blueprint $table) {
$table->boolean('indexable')->default(false)->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('indexable');
});
}
};

View file

@ -72,6 +72,8 @@
@media only screen and (min-width: 768px) {
border-right: 1px solid #dee2e6 !important
}
height: 100%;
flex-grow: 1;
}
</style>
@endpush

View file

@ -28,9 +28,17 @@
<div class="form-check pb-3">
<input class="form-check-input" type="checkbox" name="crawlable" id="crawlable" {{!$settings->crawlable ? 'checked=""':''}} {{$settings->is_private ? 'disabled=""':''}}>
<label class="form-check-label font-weight-bold" for="crawlable">
{{__('Opt-out of search engine indexing')}}
{{__('Disable Search Engine indexing')}}
</label>
<p class="text-muted small help-text">When your account is visible to search engines, your information can be crawled and stored by search engines.</p>
<p class="text-muted small help-text">When your account is visible to search engines, your information can be crawled and stored by search engines. {!! $settings->is_private ? '<strong>Not available when your account is private</strong>' : ''!!}</p>
</div>
<div class="form-check pb-3">
<input class="form-check-input" type="checkbox" name="indexable" id="indexable" {{$profile->indexable ? 'checked=""':''}} {{$settings->is_private ? 'disabled=""':''}}>
<label class="form-check-label font-weight-bold" for="indexable">
{{__('Include public posts in search results')}}
</label>
<p class="text-muted small help-text">Your public posts may appear in search results on Pixelfed and Mastodon. People who have interacted with your posts may be able to search them regardless. {!! $settings->is_private ? '<strong>Not available when your account is private</strong>' : ''!!}</p>
</div>
@ -39,7 +47,7 @@
<label class="form-check-label font-weight-bold" for="is_suggestable">
{{__('Show on Directory')}}
</label>
<p class="text-muted small help-text">When this option is enabled, your profile is included in the Directory. Only public profiles are eligible.</p>
<p class="text-muted small help-text">When this option is enabled, your profile is included in the Directory. Only public profiles are eligible. {!! $settings->is_private ? '<strong>Not available when your account is private</strong>' : ''!!}</p>
</div>
<div class="form-check pb-3">