From fa41a3d6c61aa1eb2a38fab49a3ccc480be8f2cc Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 6 Apr 2013 11:47:47 -0700 Subject: [PATCH] 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 --- .../macro/controller/PhabricatorMacroEditController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/applications/macro/controller/PhabricatorMacroEditController.php b/src/applications/macro/controller/PhabricatorMacroEditController.php index 10e82ee261..e81ec229f3 100644 --- a/src/applications/macro/controller/PhabricatorMacroEditController.php +++ b/src/applications/macro/controller/PhabricatorMacroEditController.php @@ -33,7 +33,7 @@ final class PhabricatorMacroEditController $errors = array(); $e_name = true; - $e_file = true; + $e_file = pht('Provide a URL or a file'); $file = null; $can_fetch = PhabricatorEnv::getEnvConfig('security.allow-outbound-http'); @@ -97,7 +97,6 @@ final class PhabricatorMacroEditController if (!$macro->getID() && !$file) { $errors[] = pht('You must upload an image to create a macro.'); - $e_file = pht('Required'); } if (!$errors) { @@ -191,14 +190,14 @@ final class PhabricatorMacroEditController ->setLabel(pht('URL')) ->setName('url') ->setValue($request->getStr('url')) - ->setError($e_file)); + ->setError($request->getFileExists('file') ? false : $e_file)); } $form->appendChild( id(new AphrontFormFileControl()) ->setLabel($other_label) ->setName('file') - ->setError($e_file)); + ->setError($request->getStr('url') ? false : $e_file)); }