|
|
|
@ -560,24 +560,18 @@ class AdminApiController extends Controller
|
|
|
|
$action = $request->input('action');
|
|
|
|
$action = $request->input('action');
|
|
|
|
|
|
|
|
|
|
|
|
abort_if($user->is_admin == true && $action !== 'refresh_stats', 400, 'Cannot moderate admin accounts');
|
|
|
|
abort_if($user->is_admin == true && $action !== 'refresh_stats', 400, 'Cannot moderate admin accounts');
|
|
|
|
|
|
|
|
|
|
|
|
if ($action === 'delete') {
|
|
|
|
if ($action === 'delete') {
|
|
|
|
if (config('pixelfed.account_deletion') == false) {
|
|
|
|
if (config('pixelfed.account_deletion') == false) {
|
|
|
|
abort(404);
|
|
|
|
abort(404);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
abort_if($user->is_admin, 400, 'Cannot delete an admin account.');
|
|
|
|
abort_if($user->is_admin, 400, 'Cannot delete an admin account.');
|
|
|
|
|
|
|
|
|
|
|
|
$ts = now()->addMonth();
|
|
|
|
$ts = now()->addMonth();
|
|
|
|
|
|
|
|
|
|
|
|
$user->status = 'delete';
|
|
|
|
$user->status = 'delete';
|
|
|
|
$user->delete_after = $ts;
|
|
|
|
$user->delete_after = $ts;
|
|
|
|
$user->save();
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
|
|
|
|
$profile->status = 'delete';
|
|
|
|
$profile->status = 'delete';
|
|
|
|
$profile->delete_after = $ts;
|
|
|
|
$profile->delete_after = $ts;
|
|
|
|
$profile->save();
|
|
|
|
$profile->save();
|
|
|
|
|
|
|
|
|
|
|
|
ModLogService::boot()
|
|
|
|
ModLogService::boot()
|
|
|
|
->objectUid($profile->id)
|
|
|
|
->objectUid($profile->id)
|
|
|
|
->objectId($profile->id)
|
|
|
|
->objectId($profile->id)
|
|
|
|
@ -586,10 +580,8 @@ class AdminApiController extends Controller
|
|
|
|
->action('admin.user.delete')
|
|
|
|
->action('admin.user.delete')
|
|
|
|
->accessLevel('admin')
|
|
|
|
->accessLevel('admin')
|
|
|
|
->save();
|
|
|
|
->save();
|
|
|
|
|
|
|
|
|
|
|
|
PublicTimelineService::deleteByProfileId($profile->id);
|
|
|
|
PublicTimelineService::deleteByProfileId($profile->id);
|
|
|
|
NetworkTimelineService::deleteByProfileId($profile->id);
|
|
|
|
NetworkTimelineService::deleteByProfileId($profile->id);
|
|
|
|
|
|
|
|
|
|
|
|
if ($profile->user_id) {
|
|
|
|
if ($profile->user_id) {
|
|
|
|
DB::table('oauth_access_tokens')->whereUserId($user->id)->delete();
|
|
|
|
DB::table('oauth_access_tokens')->whereUserId($user->id)->delete();
|
|
|
|
DB::table('oauth_auth_codes')->whereUserId($user->id)->delete();
|
|
|
|
DB::table('oauth_auth_codes')->whereUserId($user->id)->delete();
|
|
|
|
@ -609,12 +601,13 @@ class AdminApiController extends Controller
|
|
|
|
AccountService::del($profile->id);
|
|
|
|
AccountService::del($profile->id);
|
|
|
|
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('high');
|
|
|
|
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('high');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
'status' => 200,
|
|
|
|
'status' => 200,
|
|
|
|
'msg' => 'deleted',
|
|
|
|
'msg' => 'deleted',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
} elseif ($action === 'refresh_stats') {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($action === 'refresh_stats') {
|
|
|
|
$profile->following_count = DB::table('followers')->whereProfileId($user->profile_id)->count();
|
|
|
|
$profile->following_count = DB::table('followers')->whereProfileId($user->profile_id)->count();
|
|
|
|
$profile->followers_count = DB::table('followers')->whereFollowingId($user->profile_id)->count();
|
|
|
|
$profile->followers_count = DB::table('followers')->whereFollowingId($user->profile_id)->count();
|
|
|
|
$statusCount = Status::whereProfileId($user->profile_id)
|
|
|
|
$statusCount = Status::whereProfileId($user->profile_id)
|
|
|
|
@ -685,7 +678,8 @@ class AdminApiController extends Controller
|
|
|
|
->save();
|
|
|
|
->save();
|
|
|
|
$profile->no_autolink = ! $profile->no_autolink;
|
|
|
|
$profile->no_autolink = ! $profile->no_autolink;
|
|
|
|
$profile->save();
|
|
|
|
$profile->save();
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
$profile->{$action} = filter_var($request->input('value'), FILTER_VALIDATE_BOOLEAN);
|
|
|
|
$profile->{$action} = filter_var($request->input('value'), FILTER_VALIDATE_BOOLEAN);
|
|
|
|
$profile->save();
|
|
|
|
$profile->save();
|
|
|
|
|
|
|
|
|
|
|
|
@ -741,9 +735,8 @@ class AdminApiController extends Controller
|
|
|
|
->when($filter, function ($query, $filter) {
|
|
|
|
->when($filter, function ($query, $filter) {
|
|
|
|
if ($filter === 'all') {
|
|
|
|
if ($filter === 'all') {
|
|
|
|
return $query;
|
|
|
|
return $query;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return $query->where($filter, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $query->where($filter, true);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
->when($sortBy, function ($query, $sortBy) use ($sort) {
|
|
|
|
->when($sortBy, function ($query, $sortBy) use ($sort) {
|
|
|
|
return $query->orderBy($sortBy, $sort);
|
|
|
|
return $query->orderBy($sortBy, $sort);
|
|
|
|
|