mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update domain block commands
This commit is contained in:
parent
f3f0175c84
commit
519c7a3735
2 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use App\Models\DefaultDomainBlock;
|
||||||
use App\Models\UserDomainBlock;
|
use App\Models\UserDomainBlock;
|
||||||
use function Laravel\Prompts\text;
|
use function Laravel\Prompts\text;
|
||||||
use function Laravel\Prompts\confirm;
|
use function Laravel\Prompts\confirm;
|
||||||
|
@ -31,6 +32,7 @@ class AddUserDomainBlock extends Command
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$domain = text('Enter domain you want to block');
|
$domain = text('Enter domain you want to block');
|
||||||
|
$domain = strtolower($domain);
|
||||||
$domain = $this->validateDomain($domain);
|
$domain = $this->validateDomain($domain);
|
||||||
$this->processBlocks($domain);
|
$this->processBlocks($domain);
|
||||||
return;
|
return;
|
||||||
|
@ -74,6 +76,9 @@ class AddUserDomainBlock extends Command
|
||||||
|
|
||||||
protected function processBlocks($domain)
|
protected function processBlocks($domain)
|
||||||
{
|
{
|
||||||
|
DefaultDomainBlock::updateOrCreate([
|
||||||
|
'domain' => $domain
|
||||||
|
]);
|
||||||
progress(
|
progress(
|
||||||
label: 'Updating user domain blocks...',
|
label: 'Updating user domain blocks...',
|
||||||
steps: User::lazyById(500),
|
steps: User::lazyById(500),
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use App\Models\DefaultDomainBlock;
|
||||||
use App\Models\UserDomainBlock;
|
use App\Models\UserDomainBlock;
|
||||||
use function Laravel\Prompts\text;
|
use function Laravel\Prompts\text;
|
||||||
use function Laravel\Prompts\confirm;
|
use function Laravel\Prompts\confirm;
|
||||||
|
@ -31,6 +32,7 @@ class DeleteUserDomainBlock extends Command
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$domain = text('Enter domain you want to unblock');
|
$domain = text('Enter domain you want to unblock');
|
||||||
|
$domain = strtolower($domain);
|
||||||
$domain = $this->validateDomain($domain);
|
$domain = $this->validateDomain($domain);
|
||||||
$this->processUnblocks($domain);
|
$this->processUnblocks($domain);
|
||||||
return;
|
return;
|
||||||
|
@ -74,6 +76,7 @@ class DeleteUserDomainBlock extends Command
|
||||||
|
|
||||||
protected function processUnblocks($domain)
|
protected function processUnblocks($domain)
|
||||||
{
|
{
|
||||||
|
DefaultDomainBlock::whereDomain($domain)->delete();
|
||||||
progress(
|
progress(
|
||||||
label: 'Updating user domain blocks...',
|
label: 'Updating user domain blocks...',
|
||||||
steps: UserDomainBlock::whereDomain($domain)->lazyById(500),
|
steps: UserDomainBlock::whereDomain($domain)->lazyById(500),
|
||||||
|
|
Loading…
Reference in a new issue