mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update Inbox handler, fix missing object_url and uri fields for direct statuses
This commit is contained in:
parent
dec061f5ae
commit
a0157fce0c
2 changed files with 44 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
if($status->scope && $status->scope != 'direct') {
|
||||
FeedRemoveRemotePipeline::dispatch($status->id, $status->profile_id)->onQueue('feed');
|
||||
}
|
||||
RemoteStatusDelete::dispatch($status)->onQueue('high');
|
||||
return;
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Status;
|
||||
use Illuminate\Database\UniqueConstraintViolationException;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach(Status::whereScope('direct')->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
|
||||
{
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue