From 6b1f8651fb35957ce7e2232462c68ca9e9cc89b2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 19 Jan 2023 07:25:27 -0700 Subject: [PATCH] Add migration --- ...3_01_19_141156_fix_bookmark_visibility.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 database/migrations/2023_01_19_141156_fix_bookmark_visibility.php diff --git a/database/migrations/2023_01_19_141156_fix_bookmark_visibility.php b/database/migrations/2023_01_19_141156_fix_bookmark_visibility.php new file mode 100644 index 000000000..50cb88090 --- /dev/null +++ b/database/migrations/2023_01_19_141156_fix_bookmark_visibility.php @@ -0,0 +1,54 @@ +status_id); + if(!$status) { + $bookmark->delete(); + continue; + } + + if(!in_array($status->visibility, ['public', 'unlisted', 'private'])) { + $bookmark->delete(); + continue; + } + + if(!in_array($status->visibility, ['public', 'unlisted'])) { + if($bookmark->profile_id == $status->profile_id) { + continue; + } else { + if(!FollowerService::follows($bookmark->profile_id, $status->profile_id)) { + $bookmark->delete(); + } + } + } + } + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +};