Skip to content

Commit fc24630

Browse files
committed
Update Privacy Settings, add support for Mastodon indexable search flag
1 parent a3696da commit fc24630

File tree

5 files changed

+64
-15
lines changed

5 files changed

+64
-15
lines changed

app/Http/Controllers/Settings/PrivacySettings.php

+12-8
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ trait PrivacySettings
2020

2121
public function privacy()
2222
{
23-
$user = Auth::user();
24-
$settings = $user->settings;
25-
$profile = $user->profile;
26-
$is_private = $profile->is_private;
27-
$settings['is_private'] = (bool) $is_private;
23+
$user = Auth::user();
24+
$settings = $user->settings;
25+
$profile = $user->profile;
26+
$is_private = $profile->is_private;
27+
$settings['is_private'] = (bool) $is_private;
2828

29-
return view('settings.privacy', compact('settings', 'profile'));
29+
return view('settings.privacy', compact('settings', 'profile'));
3030
}
3131

3232
public function privacyStore(Request $request)
@@ -39,11 +39,13 @@ public function privacyStore(Request $request)
3939
'public_dm',
4040
'show_profile_follower_count',
4141
'show_profile_following_count',
42+
'indexable',
4243
'show_atom',
4344
];
4445

45-
$profile->is_suggestable = $request->input('is_suggestable') == 'on';
46-
$profile->save();
46+
$profile->indexable = $request->input('indexable') == 'on';
47+
$profile->is_suggestable = $request->input('is_suggestable') == 'on';
48+
$profile->save();
4749

4850
foreach ($fields as $field) {
4951
$form = $request->input($field);
@@ -70,6 +72,8 @@ public function privacyStore(Request $request)
7072
} else {
7173
$settings->{$field} = false;
7274
}
75+
} elseif ($field == 'indexable') {
76+
7377
} else {
7478
if ($form == 'on') {
7579
$settings->{$field} = true;

app/Transformer/ActivityPub/ProfileTransformer.php

+7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ public function transform(Profile $profile)
1616
'https://www.w3.org/ns/activitystreams',
1717
[
1818
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
19+
'pixelfed' => 'http://pixelfed.org/ns#',
20+
'schema' => 'http://schema.org/',
1921
'alsoKnownAs' => [
2022
'@id' => 'as:alsoKnownAs',
2123
'@type' => '@id'
2224
],
2325
'movedTo' => [
2426
'@id' => 'as:movedTo',
2527
'@type' => '@id'
28+
],
29+
'indexable' => [
30+
'@id' => 'pixelfed:indexable',
31+
'@type' => 'schema:Boolean'
2632
]
2733
],
2834
],
@@ -37,6 +43,7 @@ public function transform(Profile $profile)
3743
'summary' => $profile->bio,
3844
'url' => $profile->url(),
3945
'manuallyApprovesFollowers' => (bool) $profile->is_private,
46+
'indexable' => (bool) $profile->indexable,
4047
'publicKey' => [
4148
'id' => $profile->permalink().'#main-key',
4249
'owner' => $profile->permalink(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('profiles', function (Blueprint $table) {
15+
$table->boolean('indexable')->default(false)->index();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('profiles', function (Blueprint $table) {
25+
$table->dropColumn('indexable');
26+
});
27+
}
28+
};

resources/views/settings/partial/sidebar.blade.php

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
@media only screen and (min-width: 768px) {
7373
border-right: 1px solid #dee2e6 !important
7474
}
75+
height: 100%;
76+
flex-grow: 1;
7577
}
7678
</style>
7779
@endpush

resources/views/settings/privacy.blade.php

+15-7
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@
2828
<div class="form-check pb-3">
2929
<input class="form-check-input" type="checkbox" name="crawlable" id="crawlable" {{!$settings->crawlable ? 'checked=""':''}} {{$settings->is_private ? 'disabled=""':''}}>
3030
<label class="form-check-label font-weight-bold" for="crawlable">
31-
{{__('Opt-out of search engine indexing')}}
31+
{{__('Disable Search Engine indexing')}}
3232
</label>
33-
<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>
33+
<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>
34+
</div>
35+
36+
<div class="form-check pb-3">
37+
<input class="form-check-input" type="checkbox" name="indexable" id="indexable" {{$profile->indexable ? 'checked=""':''}} {{$settings->is_private ? 'disabled=""':''}}>
38+
<label class="form-check-label font-weight-bold" for="indexable">
39+
{{__('Include public posts in search results')}}
40+
</label>
41+
<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>
3442
</div>
3543

3644

@@ -39,7 +47,7 @@
3947
<label class="form-check-label font-weight-bold" for="is_suggestable">
4048
{{__('Show on Directory')}}
4149
</label>
42-
<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>
50+
<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>
4351
</div>
4452

4553
<div class="form-check pb-3">
@@ -97,10 +105,10 @@
97105
<p class="text-muted small help-text mb-0">Enable your profile atom feed. Only public profiles are eligible.</p>
98106
@if($settings->show_atom)
99107
<p class="small">
100-
<a href="{{$profile->permalink('.atom')}}" class="text-success font-weight-bold small" target="_blank">
101-
{{ $profile->permalink('.atom') }}
102-
<i class="far fa-external-link ml-1 text-muted" style="opacity: 0.5"></i>
103-
</a>
108+
<a href="{{$profile->permalink('.atom')}}" class="text-success font-weight-bold small" target="_blank">
109+
{{ $profile->permalink('.atom') }}
110+
<i class="far fa-external-link ml-1 text-muted" style="opacity: 0.5"></i>
111+
</a>
104112
</p>
105113
@endif
106114
</div>

0 commit comments

Comments
 (0)