mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Update AdminReportController
This commit is contained in:
parent
03ad41e2c4
commit
06ebb514d7
1 changed files with 77 additions and 38 deletions
|
@ -3,18 +3,19 @@
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\AccountInterstitial;
|
use App\AccountInterstitial;
|
||||||
use App\Http\Resources\AdminReport;
|
|
||||||
use App\Http\Resources\AdminRemoteReport;
|
use App\Http\Resources\AdminRemoteReport;
|
||||||
|
use App\Http\Resources\AdminReport;
|
||||||
use App\Http\Resources\AdminSpamReport;
|
use App\Http\Resources\AdminSpamReport;
|
||||||
use App\Jobs\DeletePipeline\DeleteAccountPipeline;
|
use App\Jobs\DeletePipeline\DeleteAccountPipeline;
|
||||||
use App\Jobs\DeletePipeline\DeleteRemoteProfilePipeline;
|
use App\Jobs\DeletePipeline\DeleteRemoteProfilePipeline;
|
||||||
use App\Jobs\StatusPipeline\RemoteStatusDelete;
|
use App\Jobs\StatusPipeline\RemoteStatusDelete;
|
||||||
use App\Jobs\StatusPipeline\StatusDelete;
|
use App\Jobs\StatusPipeline\StatusDelete;
|
||||||
use App\Jobs\StoryPipeline\StoryDelete;
|
use App\Jobs\StoryPipeline\StoryDelete;
|
||||||
|
use App\Models\ModeratedProfile;
|
||||||
|
use App\Models\RemoteReport;
|
||||||
use App\Notification;
|
use App\Notification;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use App\Report;
|
use App\Report;
|
||||||
use App\Models\RemoteReport;
|
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
use App\Services\ModLogService;
|
use App\Services\ModLogService;
|
||||||
use App\Services\NetworkTimelineService;
|
use App\Services\NetworkTimelineService;
|
||||||
|
@ -25,11 +26,11 @@ use App\Status;
|
||||||
use App\Story;
|
use App\Story;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Storage;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
use Storage;
|
||||||
|
|
||||||
trait AdminReportController
|
trait AdminReportController
|
||||||
{
|
{
|
||||||
|
@ -201,10 +202,7 @@ trait AdminReportController
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,6 +827,16 @@ trait AdminReportController
|
||||||
$profile->cw = true;
|
$profile->cw = true;
|
||||||
$profile->save();
|
$profile->save();
|
||||||
|
|
||||||
|
if ($profile->remote_url) {
|
||||||
|
ModeratedProfile::updateOrCreate([
|
||||||
|
'profile_url' => $profile->remote_url,
|
||||||
|
'profile_id' => $profile->id,
|
||||||
|
], [
|
||||||
|
'is_nsfw' => true,
|
||||||
|
'domain' => $profile->domain,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Status::whereProfileId($profile->id)->cursor() as $status) {
|
foreach (Status::whereProfileId($profile->id)->cursor() as $status) {
|
||||||
$status->is_nsfw = true;
|
$status->is_nsfw = true;
|
||||||
$status->save();
|
$status->save();
|
||||||
|
@ -879,6 +887,16 @@ trait AdminReportController
|
||||||
$profile->unlisted = true;
|
$profile->unlisted = true;
|
||||||
$profile->save();
|
$profile->save();
|
||||||
|
|
||||||
|
if ($profile->remote_url) {
|
||||||
|
ModeratedProfile::updateOrCreate([
|
||||||
|
'profile_url' => $profile->remote_url,
|
||||||
|
'profile_id' => $profile->id,
|
||||||
|
], [
|
||||||
|
'is_unlisted' => true,
|
||||||
|
'domain' => $profile->domain,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Status::whereProfileId($profile->id)->whereScope('public')->cursor() as $status) {
|
foreach (Status::whereProfileId($profile->id)->whereScope('public')->cursor() as $status) {
|
||||||
$status->scope = 'unlisted';
|
$status->scope = 'unlisted';
|
||||||
$status->visibility = 'unlisted';
|
$status->visibility = 'unlisted';
|
||||||
|
@ -929,6 +947,16 @@ trait AdminReportController
|
||||||
$profile->unlisted = true;
|
$profile->unlisted = true;
|
||||||
$profile->save();
|
$profile->save();
|
||||||
|
|
||||||
|
if ($profile->remote_url) {
|
||||||
|
ModeratedProfile::updateOrCreate([
|
||||||
|
'profile_url' => $profile->remote_url,
|
||||||
|
'profile_id' => $profile->id,
|
||||||
|
], [
|
||||||
|
'is_unlisted' => true,
|
||||||
|
'domain' => $profile->domain,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Status::whereProfileId($profile->id)->cursor() as $status) {
|
foreach (Status::whereProfileId($profile->id)->cursor() as $status) {
|
||||||
$status->scope = 'private';
|
$status->scope = 'private';
|
||||||
$status->visibility = 'private';
|
$status->visibility = 'private';
|
||||||
|
@ -982,6 +1010,16 @@ trait AdminReportController
|
||||||
|
|
||||||
$ts = now()->addMonth();
|
$ts = now()->addMonth();
|
||||||
|
|
||||||
|
if ($profile->remote_url) {
|
||||||
|
ModeratedProfile::updateOrCreate([
|
||||||
|
'profile_url' => $profile->remote_url,
|
||||||
|
'profile_id' => $profile->id,
|
||||||
|
], [
|
||||||
|
'is_banned' => true,
|
||||||
|
'domain' => $profile->domain,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($profile->user_id) {
|
if ($profile->user_id) {
|
||||||
$user = $profile->user;
|
$user = $profile->user;
|
||||||
abort_if($user->is_admin, 403, 'You cannot delete admin accounts.');
|
abort_if($user->is_admin, 403, 'You cannot delete admin accounts.');
|
||||||
|
@ -1354,7 +1392,7 @@ trait AdminReportController
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'id' => 'required|exists:remote_reports,id',
|
'id' => 'required|exists:remote_reports,id',
|
||||||
'action' => 'required|in:mark-read,cw-posts,unlist-posts,delete-posts,private-posts,mark-all-read-by-domain,mark-all-read-by-username,cw-all-posts,private-all-posts,unlist-all-posts'
|
'action' => 'required|in:mark-read,cw-posts,unlist-posts,delete-posts,private-posts,mark-all-read-by-domain,mark-all-read-by-username,cw-all-posts,private-all-posts,unlist-all-posts',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$report = RemoteReport::findOrFail($request->input('id'));
|
$report = RemoteReport::findOrFail($request->input('id'));
|
||||||
|
@ -1504,7 +1542,7 @@ trait AdminReportController
|
||||||
->action('admin.report.moderate')
|
->action('admin.report.moderate')
|
||||||
->metadata([
|
->metadata([
|
||||||
'action' => $request->input('action'),
|
'action' => $request->input('action'),
|
||||||
'duration_active' => now()->parse($report->created_at)->diffForHumans()
|
'duration_active' => now()->parse($report->created_at)->diffForHumans(),
|
||||||
])
|
])
|
||||||
->accessLevel('admin')
|
->accessLevel('admin')
|
||||||
->save();
|
->save();
|
||||||
|
@ -1516,6 +1554,7 @@ trait AdminReportController
|
||||||
->update(['action_taken_at' => now()]);
|
->update(['action_taken_at' => now()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [200];
|
return [200];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue