From f70826e18c147817b69d5255775f456402acadc6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 27 Dec 2020 18:00:43 -0700 Subject: [PATCH] Update status model, use scope over deprecated visibility attribute --- app/Http/Controllers/Api/ApiV1Controller.php | 4 ++-- app/Http/Controllers/DiscoverController.php | 4 ++-- app/Http/Controllers/PublicApiController.php | 4 ++-- app/Transformer/ActivityPub/ProfileOutbox.php | 2 +- app/Util/ActivityPub/Outbox.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 1e7ef4846..b185ac545 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1446,7 +1446,7 @@ class ApiV1Controller extends Controller ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) ->with('profile', 'hashtags', 'mentions') ->where('id', $dir, $id) - ->whereVisibility('public') + ->whereScope('public') ->latest() ->limit($limit) ->get(); @@ -1473,7 +1473,7 @@ class ApiV1Controller extends Controller )->whereNull('uri') ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) ->with('profile', 'hashtags', 'mentions') - ->whereVisibility('public') + ->whereScope('public') ->latest() ->simplePaginate($limit); } diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index c8b57c2a0..53c7e8caa 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -181,14 +181,14 @@ class DiscoverController extends Controller $ttl = now()->addHours(2); $res = Cache::remember($key, $ttl, function() use($range) { if($range == '-1') { - $res = Status::whereVisibility('public') + $res = Status::whereScope('public') ->whereType('photo') ->whereIsNsfw(false) ->orderBy('likes_count','desc') ->take(12) ->get(); } else { - $res = Status::whereVisibility('public') + $res = Status::whereScope('public') ->whereType('photo') ->whereIsNsfw(false) ->orderBy('likes_count','desc') diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 5659dcbcb..3ba2e01da 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -304,7 +304,7 @@ class PublicApiController extends Controller ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) ->whereNotIn('profile_id', $filtered) ->whereLocal(true) - ->whereVisibility('public') + ->whereScope('public') ->orderBy('created_at', 'desc') ->limit($limit) ->get(); @@ -332,7 +332,7 @@ class PublicApiController extends Controller ->whereNotIn('profile_id', $filtered) ->with('profile', 'hashtags', 'mentions') ->whereLocal(true) - ->whereVisibility('public') + ->whereScope('public') ->orderBy('created_at', 'desc') ->simplePaginate($limit); } diff --git a/app/Transformer/ActivityPub/ProfileOutbox.php b/app/Transformer/ActivityPub/ProfileOutbox.php index bd82d9b16..98707b30d 100644 --- a/app/Transformer/ActivityPub/ProfileOutbox.php +++ b/app/Transformer/ActivityPub/ProfileOutbox.php @@ -27,7 +27,7 @@ class ProfileOutbox extends Fractal\TransformerAbstract $statuses = $profile ->statuses() ->with('media') - ->whereVisibility('public') + ->whereScope('public') ->orderBy('created_at', 'desc') ->paginate(10); diff --git a/app/Util/ActivityPub/Outbox.php b/app/Util/ActivityPub/Outbox.php index 630951334..3e5f78a74 100644 --- a/app/Util/ActivityPub/Outbox.php +++ b/app/Util/ActivityPub/Outbox.php @@ -26,7 +26,7 @@ class Outbox { $timeline = $profile ->statuses() - ->whereVisibility('public') + ->whereScope('public') ->orderBy('created_at', 'desc') ->take(10) ->get();