From b3397030e6c912ca759ab55f11deb4fe386d457a Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 29 Apr 2011 22:26:22 -0700 Subject: [PATCH] Fix Differential "unsubscribe" so it properly blocks resubscription Summary: DifferentialRevision stores this field as a dictionary but the Editor incorrectly passed it to Herald as a raw value array. Ideally the property should be called unsubscribedDict or something but I'm increasingly thinking we're going to centralize subscriptions for Adjutant or some similar system so I'm disinclined to pursue the schema change just yet. I provided an explicit raw-value-oriented API, at least. Test Plan: With two accounts, A and B: created universal Herald CC rule with user B, created a revision with user A, had user B unsubscribe, had user A update the revision. User B was not resubscribed. Reviewed By: aran Reviewers: jungejason, tuomaspelkonen, aran CC: ola, aran, epriestley Differential Revision: 188 --- .../editor/revision/DifferentialRevisionEditor.php | 2 +- .../differential/storage/revision/DifferentialRevision.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php index 0c0f23c13b..272b529743 100644 --- a/src/applications/differential/editor/revision/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/revision/DifferentialRevisionEditor.php @@ -204,7 +204,7 @@ class DifferentialRevisionEditor { $diff); $adapter->setExplicitCCs($new['ccs']); $adapter->setExplicitReviewers($new['rev']); - $adapter->setForbiddenCCs($revision->getUnsubscribed()); + $adapter->setForbiddenCCs($revision->getUnsubscribedPHIDs()); $xscript = HeraldEngine::loadAndApplyRules($adapter); $xscript_uri = PhabricatorEnv::getProductionURI( diff --git a/src/applications/differential/storage/revision/DifferentialRevision.php b/src/applications/differential/storage/revision/DifferentialRevision.php index 910e4bd290..162e777d50 100644 --- a/src/applications/differential/storage/revision/DifferentialRevision.php +++ b/src/applications/differential/storage/revision/DifferentialRevision.php @@ -151,4 +151,8 @@ class DifferentialRevision extends DifferentialDAO { public function getRawRelations($relation) { return idx($this->relationships, $relation, array()); } + + public function getUnsubscribedPHIDs() { + return array_keys($this->getUnsubscribed()); + } }