Update InternalApiController

This commit is contained in:
Daniel Supernault 2019-01-10 20:45:19 -07:00
parent dc7e90d4b5
commit 7a80216462
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -54,6 +54,7 @@ class InternalApiController extends Controller
$attachments = [];
$status = new Status;
$mimes = [];
$cw = false;
foreach($medias as $k => $media) {
$m = Media::findOrFail($media['id']);
@ -64,7 +65,8 @@ class InternalApiController extends Controller
$m->license = $media['license'];
$m->caption = strip_tags($media['alt']);
$m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k;
if($media['cw'] == true) {
if($media['cw'] == true || $profile->cw == true) {
$cw = true;
$m->is_nsfw = true;
$status->is_nsfw = true;
}
@ -84,6 +86,9 @@ class InternalApiController extends Controller
$media->save();
}
$visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
$cw = $profile->cw == true ? true : $cw;
$status->is_nsfw = $cw;
$status->visibility = $visibility;
$status->scope = $visibility;
$status->type = StatusController::mimeTypeCheck($mimes);