From a0157fce0c1ab287373924558f95962ae0df540f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 01:13:04 -0700 Subject: [PATCH 1/2] Update Inbox handler, fix missing object_url and uri fields for direct statuses --- app/Util/ActivityPub/Inbox.php | 15 ++++++--- ...d_direct_object_urls_to_statuses_table.php | 33 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 database/migrations/2023_12_08_074345_add_direct_object_urls_to_statuses_table.php diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php index e97eda34d..7cb25af82 100644 --- a/app/Util/ActivityPub/Inbox.php +++ b/app/Util/ActivityPub/Inbox.php @@ -282,8 +282,8 @@ class Inbox } if($actor->followers_count == 0) { - if(config('federation.activitypub.ingest.store_notes_without_followers')) { - } else if(FollowerService::followerCount($actor->id, true) == 0) { + if(config('federation.activitypub.ingest.store_notes_without_followers')) { + } else if(FollowerService::followerCount($actor->id, true) == 0) { return; } } @@ -401,6 +401,8 @@ class Inbox $status->visibility = 'direct'; $status->scope = 'direct'; $status->url = $activity['id']; + $status->uri = $activity['id']; + $status->object_url = $activity['id']; $status->in_reply_to_profile_id = $profile->id; $status->save(); @@ -703,12 +705,17 @@ class Inbox return; } $status = Status::whereProfileId($profile->id) - ->whereObjectUrl($id) + ->where(function($q) use($id) { + return $q->where('object_url', $id) + ->orWhere('url', $id); + }) ->first(); if(!$status) { return; } - FeedRemoveRemotePipeline::dispatch($status->id, $status->profile_id)->onQueue('feed'); + if($status->scope && $status->scope != 'direct') { + FeedRemoveRemotePipeline::dispatch($status->id, $status->profile_id)->onQueue('feed'); + } RemoteStatusDelete::dispatch($status)->onQueue('high'); return; break; diff --git a/database/migrations/2023_12_08_074345_add_direct_object_urls_to_statuses_table.php b/database/migrations/2023_12_08_074345_add_direct_object_urls_to_statuses_table.php new file mode 100644 index 000000000..5211c658f --- /dev/null +++ b/database/migrations/2023_12_08_074345_add_direct_object_urls_to_statuses_table.php @@ -0,0 +1,33 @@ +whereNotNull('url')->whereNull('object_url')->lazyById(50, 'id') as $status) { + try { + $status->object_url = $status->url; + $status->uri = $status->url; + $status->save(); + } catch (Exception | UniqueConstraintViolationException $e) { + continue; + } + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + } +}; From 4cc66a838d8a69cb457e3f84c67c1e1135945d1d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 01:15:41 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eca20cc63..3aa36a529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,9 @@ - Update StoryApiV1Controller, add self-carousel endpoint. Fixes ([#4352](https://github.com/pixelfed/pixelfed/issues/4352)) ([bcb88d5b](https://github.com/pixelfed/pixelfed/commit/bcb88d5b)) - Update FollowServiceWarmCache, use more efficient query ([fe9b4c5a](https://github.com/pixelfed/pixelfed/commit/fe9b4c5a)) - Update HomeFeedPipeline, observe mutes/blocks during fanout ([8548294c](https://github.com/pixelfed/pixelfed/commit/8548294c)) +- Update FederationController, add proper following/follower counts ([3204fb96](https://github.com/pixelfed/pixelfed/commit/3204fb96)) +- Update FederationController, add proper statuses counts ([3204fb96](https://github.com/pixelfed/pixelfed/commit/3204fb96)) +- Update Inbox handler, fix missing object_url and uri fields for direct statuses ([a0157fce](https://github.com/pixelfed/pixelfed/commit/a0157fce)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)