Merge pull request #7410 from pixelfed/staging

Fix deletes
pull/7411/head^2
dansup 2 days ago committed by GitHub
commit 44ab52c70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -172,11 +172,13 @@ class DirectMessageHandler
return false;
}
if ((int) $message->profile_id === (int) $actor->id) {
$this->service->deleteMessage($message, false);
if ((int) $message->profile_id !== (int) $actor->id) {
return true;
}
return true;
$this->service->deleteMessage($message, false);
return $message->status_id === null;
}
/**

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Jobs\InboxPipeline\DeleteWorker;
use App\Jobs\InboxPipeline\InboxValidator;
use App\Jobs\InboxPipeline\InboxWorker;
use App\Models\DmMessage;
use App\Models\FeatureAuthorization;
use App\Models\Profile;
use App\Models\QuoteAuthorization;
@ -197,7 +198,7 @@ class FederationController extends Controller
}
if ($obj['object']['type'] === 'Tombstone') {
if (Status::whereObjectUrl($obj['object']['id'])->exists()) {
if ($this->isKnownTombstone($obj['object']['id'])) {
dispatch(new DeleteWorker($headers, $payload))->onQueue('delete');
return;
@ -221,6 +222,21 @@ class FederationController extends Controller
}
}
/**
* Deletes are dropped at the door unless they are for something this
* server has. A direct message is not a status, so it has to be looked
* for separately or its Delete never reaches the inbox worker.
*/
protected function isKnownTombstone(mixed $id): bool
{
if (! is_string($id) || $id === '') {
return false;
}
return Status::whereObjectUrl($id)->exists()
|| DmMessage::whereObjectUri($id)->exists();
}
public function sharedInbox(Request $request): void
{
abort_if(! (bool) config_cache('federation.activitypub.enabled'), 404);

Loading…
Cancel
Save