diff --git a/CHANGELOG.md b/CHANGELOG.md index a2c9079f..530daff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Updated RemotePost component, fix missing like button on comments ([7ef90565](https://github.com/pixelfed/pixelfed/commit/7ef90565)) - Updated PublicApiControllers, fix block/mutes filtering on public timeline ([08383dd4](https://github.com/pixelfed/pixelfed/commit/08383dd4)) - Updated FixUsernames command, fixes remote username search ([0f943f67](https://github.com/pixelfed/pixelfed/commit/0f943f67)) +- Updated Timeline component, fix mod tools ([b1d5eb05](https://github.com/pixelfed/pixelfed/commit/b1d5eb05)) ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 9d127ba0..5463c895 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -30,6 +30,8 @@ use League\Fractal\Serializer\ArraySerializer; use League\Fractal\Pagination\IlluminatePaginatorAdapter; use Illuminate\Validation\Rule; use Illuminate\Support\Str; +use App\Services\ModLogService; +use App\Services\PublicTimelineService; class InternalApiController extends Controller { @@ -161,24 +163,23 @@ class InternalApiController extends Controller public function modAction(Request $request) { - abort_unless(Auth::user()->is_admin, 403); + abort_unless(Auth::user()->is_admin, 400); $this->validate($request, [ 'action' => [ 'required', 'string', Rule::in([ - 'autocw', - 'noautolink', - 'unlisted', - 'disable', - 'suspend' + 'addcw', + 'remcw', + 'unlist' + ]) ], 'item_id' => 'required|integer|min:1', 'item_type' => [ 'required', 'string', - Rule::in(['status']) + Rule::in(['profile', 'status']) ] ]); @@ -187,48 +188,61 @@ class InternalApiController extends Controller $item_type = $request->input('item_type'); switch($action) { - case 'autocw': - $profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null; - $profile->cw = true; - $profile->save(); + case 'addcw': + $status = Status::findOrFail($item_id); + $status->is_nsfw = true; + $status->save(); + ModLogService::boot() + ->user(Auth::user()) + ->objectUid($status->profile->user_id) + ->objectId($status->id) + ->objectType('App\Status::class') + ->action('admin.status.moderate') + ->metadata([ + 'action' => 'cw', + 'message' => 'Success!' + ]) + ->accessLevel('admin') + ->save(); break; - case 'noautolink': - $profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null; - $profile->no_autolink = true; - $profile->save(); + case 'remcw': + $status = Status::findOrFail($item_id); + $status->is_nsfw = false; + $status->save(); + ModLogService::boot() + ->user(Auth::user()) + ->objectUid($status->profile->user_id) + ->objectId($status->id) + ->objectType('App\Status::class') + ->action('admin.status.moderate') + ->metadata([ + 'action' => 'remove_cw', + 'message' => 'Success!' + ]) + ->accessLevel('admin') + ->save(); break; - case 'unlisted': - $profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null; - $profile->unlisted = true; - $profile->save(); + case 'unlist': + $status = Status::whereScope('public')->findOrFail($item_id); + $status->scope = $status->visibility = 'unlisted'; + $status->save(); + PublicTimelineService::del($status->id); + ModLogService::boot() + ->user(Auth::user()) + ->objectUid($status->profile->user_id) + ->objectId($status->id) + ->objectType('App\Status::class') + ->action('admin.status.moderate') + ->metadata([ + 'action' => 'unlist', + 'message' => 'Success!' + ]) + ->accessLevel('admin') + ->save(); break; - - case 'disable': - $profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null; - $user = $profile->user; - $profile->status = 'disabled'; - $user->status = 'disabled'; - $profile->save(); - $user->save(); - break; - - - case 'suspend': - $profile = $item_type == 'status' ? Status::findOrFail($item_id)->profile : null; - $user = $profile->user; - $profile->status = 'suspended'; - $user->status = 'suspended'; - $profile->save(); - $user->save(); - break; - - default: - # code... - break; } - Cache::forget('profiles:private'); return ['msg' => 200]; } diff --git a/public/js/timeline.js b/public/js/timeline.js index 8f71e86b..82f897ce 100644 Binary files a/public/js/timeline.js and b/public/js/timeline.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 252b50c0..966872bd 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index f9e6db66..1432a9dd 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -399,55 +399,56 @@ body-class="list-group-flush p-0 rounded">
By using this embed, you agree to our Terms of Use