mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 08:14:10 +00:00
Update StatusController
This commit is contained in:
parent
e590db3f32
commit
d6ebce4780
1 changed files with 25 additions and 2 deletions
|
@ -12,8 +12,7 @@ use App\Status;
|
||||||
use App\Transformer\ActivityPub\StatusTransformer;
|
use App\Transformer\ActivityPub\StatusTransformer;
|
||||||
use App\Transformer\ActivityPub\Verb\Note;
|
use App\Transformer\ActivityPub\Verb\Note;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Auth;
|
use Auth, Cache;
|
||||||
use Cache;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
use App\Util\Media\Filter;
|
use App\Util\Media\Filter;
|
||||||
|
@ -22,6 +21,7 @@ class StatusController extends Controller
|
||||||
{
|
{
|
||||||
public function show(Request $request, $username, int $id)
|
public function show(Request $request, $username, int $id)
|
||||||
{
|
{
|
||||||
|
// $id = strlen($id) < 17 ? array_first(\Hashids::decode($id)) : $id;
|
||||||
$user = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
$user = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||||
|
|
||||||
if($user->status != null) {
|
if($user->status != null) {
|
||||||
|
@ -363,4 +363,27 @@ class StatusController extends Controller
|
||||||
return 'photo:video:album';
|
return 'photo:video:album';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toggleVisibility(Request $request) {
|
||||||
|
$this->authCheck();
|
||||||
|
$this->validate($request, [
|
||||||
|
'item' => 'required|string|min:1|max:20',
|
||||||
|
'disableComments' => 'required|boolean'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$id = $request->input('item');
|
||||||
|
$state = $request->input('disableComments');
|
||||||
|
|
||||||
|
$status = Status::findOrFail($id);
|
||||||
|
|
||||||
|
if($status->profile_id != $user->profile->id && $user->is_admin == false) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$status->comments_disabled = $status->comments_disabled == true ? false : true;
|
||||||
|
$status->save();
|
||||||
|
|
||||||
|
return response()->json([200]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue