Differential D20328 Diff 48522 src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | foreach ($xactions as $xaction) { | ||||
$file = id(new PhabricatorFileQuery()) | $file = id(new PhabricatorFileQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($file_phid)) | ->withPHIDs(array($file_phid)) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$file) { | if (!$file) { | ||||
$errors[] = $this->newInvalidError( | $errors[] = $this->newInvalidError( | ||||
pht('"%s" is not a valid file PHID.', | pht( | ||||
$file_phid)); | 'File PHID ("%s") is invalid, or you do not have permission '. | ||||
} else { | 'to view it.', | ||||
$file_phid), | |||||
$xaction); | |||||
continue; | |||||
} | |||||
if (!$file->isViewableImage()) { | if (!$file->isViewableImage()) { | ||||
$mime_type = $file->getMimeType(); | |||||
$errors[] = $this->newInvalidError( | $errors[] = $this->newInvalidError( | ||||
pht('File mime type of "%s" is not a valid viewable image.', | pht( | ||||
$mime_type)); | 'File ("%s", with MIME type "%s") is not a viewable image file.', | ||||
} | $file_phid, | ||||
$file->getMimeType()), | |||||
$xaction); | |||||
continue; | |||||
} | } | ||||
if (!$file->isTransformableImage()) { | |||||
$errors[] = $this->newInvalidError( | |||||
pht( | |||||
'File ("%s", with MIME type "%s") can not be transformed into '. | |||||
'a thumbnail. You may be missing support for this file type in '. | |||||
'the "GD" extension.', | |||||
$file_phid, | |||||
$file->getMimeType()), | |||||
$xaction); | |||||
continue; | |||||
} | |||||
} | } | ||||
return $errors; | return $errors; | ||||
} | } | ||||
public function getIcon() { | public function getIcon() { | ||||
return 'fa-image'; | return 'fa-image'; | ||||
} | } | ||||
} | } |