1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-22 07:42:41 +00:00

Add AdminShadowFilter model/migration

This commit is contained in:
Daniel Supernault 2023-09-14 22:23:46 -06:00
parent 3979e33b57
commit a510c3e89c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Services\AccountService;
class AdminShadowFilter extends Model
{
use HasFactory;
protected $guarded = [];
protected $casts = [
'created_at' => 'datetime'
];
public function account()
{
if($this->item_type === 'App\Profile') {
return AccountService::get($this->item_id, true);
}
return;
}
}

View file

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('admin_shadow_filters', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('admin_id')->nullable();
$table->morphs('item');
$table->boolean('is_local')->default(true)->index();
$table->text('note')->nullable();
$table->boolean('active')->default(false)->index();
$table->json('history')->nullable();
$table->json('ruleset')->nullable();
$table->boolean('prevent_ap_fanout')->default(false)->index();
$table->boolean('prevent_new_dms')->default(false)->index();
$table->boolean('ignore_reports')->default(false)->index();
$table->boolean('ignore_mentions')->default(false)->index();
$table->boolean('ignore_links')->default(false)->index();
$table->boolean('ignore_hashtags')->default(false)->index();
$table->boolean('hide_from_public_feeds')->default(false)->index();
$table->boolean('hide_from_tag_feeds')->default(false)->index();
$table->boolean('hide_embeds')->default(false)->index();
$table->boolean('hide_from_story_carousel')->default(false)->index();
$table->boolean('hide_from_search_autocomplete')->default(false)->index();
$table->boolean('hide_from_search')->default(false)->index();
$table->boolean('requires_login')->default(false)->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('admin_shadow_filters');
}
};