Update Inbox, improve tombstone query efficiency

This commit is contained in:
Daniel Supernault 2023-12-11 04:09:33 -07:00
parent 6dceb6f05b
commit 759a439334
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -404,7 +404,7 @@ class Inbox
$status->uri = $activity['id']; $status->uri = $activity['id'];
$status->object_url = $activity['id']; $status->object_url = $activity['id'];
$status->in_reply_to_profile_id = $profile->id; $status->in_reply_to_profile_id = $profile->id;
$status->save(); $status->saveQuietly();
$dm = new DirectMessage; $dm = new DirectMessage;
$dm->to_id = $profile->id; $dm->to_id = $profile->id;
@ -704,13 +704,15 @@ class Inbox
if(!$profile || $profile->private_key != null) { if(!$profile || $profile->private_key != null) {
return; return;
} }
$status = Status::whereProfileId($profile->id)
->where(function($q) use($id) { $status = Status::where('object_url', $id)->first();
return $q->where('object_url', $id)
->orWhere('url', $id);
})
->first();
if(!$status) { if(!$status) {
$status = Status::where('url', $id)->first();
if(!$status) {
return;
}
}
if($status->profile_id != $profile->id) {
return; return;
} }
if($status->scope && in_array($status->scope, ['public', 'unlisted', 'private'])) { if($status->scope && in_array($status->scope, ['public', 'unlisted', 'private'])) {