Update ComposeController, use placeholder image for video media. Fixes #2595

This commit is contained in:
Daniel Supernault 2021-01-30 16:34:44 -07:00
parent eab4370c84
commit 789ed4b498
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -39,6 +39,7 @@ use App\Services\NotificationService;
use App\Services\MediaPathService;
use App\Services\MediaBlocklistService;
use App\Services\MediaTagService;
use App\Services\ServiceService;
use Illuminate\Support\Str;
use App\Util\Lexer\Autolink;
use App\Util\Lexer\Extractor;
@ -117,9 +118,8 @@ class ComposeController extends Controller
$media->version = 3;
$media->save();
// $url = URL::temporarySignedRoute(
// 'temp-media', now()->addHours(1), ['profileId' => $profile->id, 'mediaId' => $media->id, 'timestamp' => time()]
// );
$preview_url = $media->url() . '?v=' . time();
$url = $media->url() . '?v=' . time();
switch ($media->mime) {
case 'image/jpeg':
@ -139,8 +139,8 @@ class ComposeController extends Controller
$resource = new Fractal\Resource\Item($media, new MediaTransformer());
$res = $this->fractal->createData($resource)->toArray();
$res['preview_url'] = $media->url() . '?v=' . time();
$res['url'] = $media->url() . '?v=' . time();
$res['preview_url'] = $preview_url;
$res['url'] = $url;
return response()->json($res);
}