From 12b966f44e5166b922602b60e06f27f949817093 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 29 Jun 2015 11:55:52 -0700 Subject: [PATCH] Spaces + Diffusion - make creating a new repository work again Summary: Fixes T8702. Needed to teach these controls how to serialize / unserialize themselves in that they are storing two values (policy phid + space phid) nowadays Test Plan: made a new repo successfully with policy as described in T8702. Also edited policy successfully. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8702 Differential Revision: https://secure.phabricator.com/D13472 --- .../form/control/AphrontFormPolicyControl.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php index 88ab482111..0d95fc4a53 100644 --- a/src/view/form/control/AphrontFormPolicyControl.php +++ b/src/view/form/control/AphrontFormPolicyControl.php @@ -39,6 +39,22 @@ final class AphrontFormPolicyControl extends AphrontFormControl { return $this; } + public function getSerializedValue() { + return json_encode(array( + $this->getValue(), + $this->getSpacePHID(), + )); + } + + public function readSerializedValue($value) { + $decoded = phutil_json_decode($value); + $policy_value = $decoded[0]; + $space_phid = $decoded[1]; + $this->setValue($policy_value); + $this->setSpacePHID($space_phid); + return $this; + } + public function readValueFromDictionary(array $dictionary) { // TODO: This is a little hacky but will only get us into trouble if we // have multiple view policy controls in multiple paged form views on the