forked from mirror/pixelfed
Merge pull request #1126 from pixelfed/frontend-ui-refactor
Update Controllers
This commit is contained in:
commit
de758f529d
|
@ -28,6 +28,7 @@ use App\Jobs\StatusPipeline\NewStatusPipeline;
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
use League\Fractal\Serializer\ArraySerializer;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class InternalApiController extends Controller
|
class InternalApiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -339,6 +340,18 @@ class InternalApiController extends Controller
|
||||||
'visibility' => 'required|string|in:public,private,unlisted|min:2|max:10'
|
'visibility' => 'required|string|in:public,private,unlisted|min:2|max:10'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if(config('costar.enabled') == true) {
|
||||||
|
$blockedKeywords = config('costar.keyword.block');
|
||||||
|
if($blockedKeywords !== null && $request->caption) {
|
||||||
|
$keywords = config('costar.keyword.block');
|
||||||
|
foreach($keywords as $kw) {
|
||||||
|
if(Str::contains($request->caption, $kw) == true) {
|
||||||
|
abort(400, 'Invalid object');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
$visibility = $request->input('visibility');
|
$visibility = $request->input('visibility');
|
||||||
$medias = $request->input('media');
|
$medias = $request->input('media');
|
||||||
|
|
|
@ -130,6 +130,18 @@ class StatusController extends Controller
|
||||||
$cw = $profile->cw == true ? true : $cw;
|
$cw = $profile->cw == true ? true : $cw;
|
||||||
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
|
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
|
||||||
|
|
||||||
|
if(config('costar.enabled') == true) {
|
||||||
|
$blockedKeywords = config('costar.keyword.block');
|
||||||
|
if($blockedKeywords !== null) {
|
||||||
|
$keywords = config('costar.keyword.block');
|
||||||
|
foreach($keywords as $kw) {
|
||||||
|
if(Str::contains($request->caption, $kw) == true) {
|
||||||
|
abort(400, 'Invalid object');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$status = new Status();
|
$status = new Status();
|
||||||
$status->profile_id = $profile->id;
|
$status->profile_id = $profile->id;
|
||||||
$status->caption = strip_tags($request->caption);
|
$status->caption = strip_tags($request->caption);
|
||||||
|
|
Loading…
Reference in New Issue