<?php

final class DifferentialEditPolicyFieldSpecification
  extends DifferentialFieldSpecification {

  private $value;

  public function shouldAppearOnEdit() {
    return true;
  }

  protected function didSetRevision() {
    $this->value = $this->getRevision()->getEditPolicy();
  }

  public function setValueFromRequest(AphrontRequest $request) {
    $this->value = $request->getStr('editPolicy');
    return $this;
  }

  public function renderEditControl() {
    $viewer = $this->getUser();
    $revision = $this->getRevision();

    $policies = id(new PhabricatorPolicyQuery())
      ->setViewer($viewer)
      ->setObject($revision)
      ->execute();

    return id(new AphrontFormPolicyControl())
      ->setUser($viewer)
      ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
      ->setPolicyObject($revision)
      ->setPolicies($policies)
      ->setName('editPolicy')
      ->setCaption(
        pht(
          'NOTE: These policy features are not yet fully supported.'));
  }

  public function willWriteRevision(DifferentialRevisionEditor $editor) {
    $this->getRevision()->setEditPolicy($this->value);
  }

}

<?php

final class DifferentialEditPolicyFieldSpecification
  extends DifferentialFieldSpecification {

  private $value;

  public function shouldAppearOnEdit() {
    return true;
  }

  protected function didSetRevision() {
    $this->value = $this->getRevision()->getEditPolicy();
  }

  public function setValueFromRequest(AphrontRequest $request) {
    $this->value = $request->getStr('editPolicy');
    return $this;
  }

  public function renderEditControl() {
    $viewer = $this->getUser();
    $revision = $this->getRevision();

    $policies = id(new PhabricatorPolicyQuery())
      ->setViewer($viewer)
      ->setObject($revision)
      ->execute();

    return id(new AphrontFormPolicyControl())
      ->setUser($viewer)
      ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
      ->setPolicyObject($revision)
      ->setPolicies($policies)
      ->setName('editPolicy');
  }

  public function willWriteRevision(DifferentialRevisionEditor $editor) {
    $this->getRevision()->setEditPolicy($this->value);
  }

}

Remove policy caveat from Differential
Remove policy caveat from Differential

Summary: Policies are now fully supported in Differential.

Test Plan: Grepped for other caveats, looks like I've already removed htem all.

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

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