Hide nsfw posts from public/network timelines by default

This commit is contained in:
Daniel Supernault 2022-11-25 22:57:31 -07:00
parent 356ffdb630
commit 3ebae614ce
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
4 changed files with 9 additions and 2 deletions

View file

@ -322,6 +322,7 @@ class PublicApiController extends Controller
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereLocal(true)
->where('is_nsfw', false)
->whereScope('public')
->orderBy('id', 'desc')
->limit($limit)
@ -365,6 +366,7 @@ class PublicApiController extends Controller
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereLocal(true)
->where('is_nsfw', false)
->whereScope('public')
->orderBy('id', 'desc')
->limit($limit)
@ -620,7 +622,8 @@ class PublicApiController extends Controller
'scope',
'created_at',
)
->where('id', $dir, $id)
->where('id', $dir, $id)
->where('is_nsfw', false)
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereNotIn('profile_id', $filtered)
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
@ -648,6 +651,7 @@ class PublicApiController extends Controller
)
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereNotIn('profile_id', $filtered)
->where('is_nsfw', false)
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereNotNull('uri')
->whereScope('public')

View file

@ -171,7 +171,8 @@ class StatusEntityLexer implements ShouldQueue
$status->scope == 'public' &&
in_array($status->type, $types) &&
$status->in_reply_to_id === null &&
$status->reblog_of_id === null
$status->reblog_of_id === null &&
$status->is_nsfw == false
) {
PublicTimelineService::add($status->id);
}

View file

@ -78,6 +78,7 @@ class NetworkTimelineService
Redis::del(self::CACHE_KEY);
$ids = Status::whereNotNull('uri')
->whereScope('public')
->where('is_nsfw', false)
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])

View file

@ -78,6 +78,7 @@ class PublicTimelineService {
Redis::del(self::CACHE_KEY);
$ids = Status::whereNull('uri')
->whereNull('in_reply_to_id')
->where('is_nsfw', false)
->whereNull('reblog_of_id')
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereScope('public')