1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Don't mark URL in creating macro as required

Test Plan: /macro/create/

Reviewers: mattrobenolt, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D5405
This commit is contained in:
Jakub Vrana 2013-04-06 11:47:47 -07:00
parent 338851ac54
commit fa41a3d6c6

View file

@ -33,7 +33,7 @@ final class PhabricatorMacroEditController
$errors = array(); $errors = array();
$e_name = true; $e_name = true;
$e_file = true; $e_file = pht('Provide a URL or a file');
$file = null; $file = null;
$can_fetch = PhabricatorEnv::getEnvConfig('security.allow-outbound-http'); $can_fetch = PhabricatorEnv::getEnvConfig('security.allow-outbound-http');
@ -97,7 +97,6 @@ final class PhabricatorMacroEditController
if (!$macro->getID() && !$file) { if (!$macro->getID() && !$file) {
$errors[] = pht('You must upload an image to create a macro.'); $errors[] = pht('You must upload an image to create a macro.');
$e_file = pht('Required');
} }
if (!$errors) { if (!$errors) {
@ -191,14 +190,14 @@ final class PhabricatorMacroEditController
->setLabel(pht('URL')) ->setLabel(pht('URL'))
->setName('url') ->setName('url')
->setValue($request->getStr('url')) ->setValue($request->getStr('url'))
->setError($e_file)); ->setError($request->getFileExists('file') ? false : $e_file));
} }
$form->appendChild( $form->appendChild(
id(new AphrontFormFileControl()) id(new AphrontFormFileControl())
->setLabel($other_label) ->setLabel($other_label)
->setName('file') ->setName('file')
->setError($e_file)); ->setError($request->getStr('url') ? false : $e_file));
} }