@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix two bugs with Config's Edit controller.

Summary:
* When we restored to the default value, we did, in fact delete the row from the
database, but then a few lines later down, we saved it again. This patch causes
the controller to return early on delete, like it was supposed to do to begin
with.
* When checking the user's input value for `null` (since PHP's JSON encoder will
return `null` on failure), check the value that the user gave, not the value
that we default to (which is often `null` anyway). Oops.

Test Plan:
* Saved an empty text field and saw the delete work properly and NOT get
re-added.
* Put `null` in the text field, and saved successfully.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4300

authored by

Ricky Elrod and committed by
epriestley
908253f1 250fe7fb

+3 -1
+3 -1
src/applications/config/controller/PhabricatorConfigEditController.php
··· 42 42 $new_value = $request->getStr('value'); 43 43 if (strlen($new_value)) { 44 44 $json = json_decode($new_value, true); 45 - if ($json === null && strtolower($value) != 'null') { 45 + if ($json === null && strtolower($new_value) != 'null') { 46 46 $e_value = 'Invalid'; 47 47 $errors[] = 'The given value must be valid JSON. This means, among '. 48 48 'other things, that you must wrap strings in double-quotes.'; ··· 53 53 } else { 54 54 // TODO: When we do Transactions, make this just set isDeleted = 1 55 55 $config_entry->delete(); 56 + return id(new AphrontRedirectResponse()) 57 + ->setURI($config_entry->getURI()); 56 58 } 57 59 58 60 $config_entry->setValue($value);