Differential D14869 Diff 35956 src/applications/project/editor/PhabricatorProjectTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
Show First 20 Lines • Show All 686 Lines • ▼ Show 20 Lines | private function normalizeSlugs(array $slugs) { | ||||
} | } | ||||
$slugs = array_unique($slugs); | $slugs = array_unique($slugs); | ||||
$slugs = array_values($slugs); | $slugs = array_values($slugs); | ||||
return $slugs; | return $slugs; | ||||
} | } | ||||
protected function adjustObjectForPolicyChecks( | |||||
PhabricatorLiskDAO $object, | |||||
array $xactions) { | |||||
$copy = parent::adjustObjectForPolicyChecks($object, $xactions); | |||||
$type_edge = PhabricatorTransactions::TYPE_EDGE; | |||||
$edgetype_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; | |||||
$member_xaction = null; | |||||
foreach ($xactions as $xaction) { | |||||
if ($xaction->getTransactionType() !== $type_edge) { | |||||
continue; | |||||
} | |||||
$edgetype = $xaction->getMetadataValue('edge:type'); | |||||
if ($edgetype !== $edgetype_member) { | |||||
continue; | |||||
} | |||||
$member_xaction = $xaction; | |||||
} | |||||
if ($member_xaction) { | |||||
$object_phid = $object->getPHID(); | |||||
if ($object_phid) { | |||||
$members = PhabricatorEdgeQuery::loadDestinationPHIDs( | |||||
$object_phid, | |||||
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST); | |||||
} else { | |||||
$members = array(); | |||||
} | |||||
$clone_xaction = clone $member_xaction; | |||||
$hint = $this->getPHIDTransactionNewValue($clone_xaction, $members); | |||||
$rule = new PhabricatorProjectMembersPolicyRule(); | |||||
$hint = array_fuse($hint); | |||||
PhabricatorPolicyRule::passTransactionHintToRule( | |||||
$copy, | |||||
$rule, | |||||
$hint); | |||||
} | |||||
return $copy; | |||||
} | |||||
} | } |