mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-02-23 14:40:49 +00:00
Fix the local column for statuses to not include remote shares (#5513)
* Fix the local column for statuses to not include remote shares * Chunk the migration
This commit is contained in:
parent
8fad89543f
commit
d97383c0f6
2 changed files with 32 additions and 0 deletions
|
@ -645,6 +645,7 @@ class Inbox
|
|||
'profile_id' => $actor->id,
|
||||
'reblog_of_id' => $parent->id,
|
||||
'type' => 'share',
|
||||
'local' => false,
|
||||
]);
|
||||
|
||||
Notification::firstOrCreate(
|
||||
|
|
31
database/migrations/2025_01_18_061532_fix_local_statuses.php
Normal file
31
database/migrations/2025_01_18_061532_fix_local_statuses.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Status;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Status::query()
|
||||
->where('local', true)
|
||||
->where('type', 'share')
|
||||
->whereHas('profile', function($query) {
|
||||
$query->whereDoesntHave('user');
|
||||
})
|
||||
->chunkById(100, function($statuses) {
|
||||
foreach($statuses as $status) {
|
||||
$status->local = false;
|
||||
$status->save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// No down migration needed since this is a data fix
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue