Update ApiV1Controller, add comments_disabled param to /api/v1/statuses endpoint
This commit is contained in:
parent
7baf4495a0
commit
95b5861094
1 changed files with 8 additions and 0 deletions
|
@ -2486,6 +2486,7 @@ class ApiV1Controller extends Controller
|
||||||
'spoiler_text' => 'sometimes|max:140',
|
'spoiler_text' => 'sometimes|max:140',
|
||||||
'place_id' => 'sometimes|integer|min:1|max:128769',
|
'place_id' => 'sometimes|integer|min:1|max:128769',
|
||||||
'collection_ids' => 'sometimes|array|max:3',
|
'collection_ids' => 'sometimes|array|max:3',
|
||||||
|
'comments_disabled' => 'sometimes|boolean',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if(config('costar.enabled') == true) {
|
if(config('costar.enabled') == true) {
|
||||||
|
@ -2540,6 +2541,9 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
if($in_reply_to_id) {
|
if($in_reply_to_id) {
|
||||||
$parent = Status::findOrFail($in_reply_to_id);
|
$parent = Status::findOrFail($in_reply_to_id);
|
||||||
|
if($parent->comments_disabled) {
|
||||||
|
return $this->json("Comments have been disabled on this post", 422);
|
||||||
|
}
|
||||||
$blocks = UserFilterService::blocks($parent->profile_id);
|
$blocks = UserFilterService::blocks($parent->profile_id);
|
||||||
abort_if(in_array($profile->id, $blocks), 422, 'Cannot reply to this post at this time.');
|
abort_if(in_array($profile->id, $blocks), 422, 'Cannot reply to this post at this time.');
|
||||||
|
|
||||||
|
@ -2601,6 +2605,10 @@ class ApiV1Controller extends Controller
|
||||||
abort(400, 'Invalid media ids');
|
abort(400, 'Invalid media ids');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($request->has('comments_disabled') && $request->input('comments_disabled')) {
|
||||||
|
$status->comments_disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
$status->scope = $visibility;
|
$status->scope = $visibility;
|
||||||
$status->visibility = $visibility;
|
$status->visibility = $visibility;
|
||||||
$status->type = StatusController::mimeTypeCheck($mimes);
|
$status->type = StatusController::mimeTypeCheck($mimes);
|
||||||
|
|
Loading…
Reference in a new issue