<?php

final class PhabricatorMetaMTAApplicationEmailHeraldField
  extends HeraldField {

  const FIELDCONST = 'application-email';

  public function getHeraldFieldName() {
    return pht('Receiving email address');
  }

  public function supportsObject($object) {
    return $this->getAdapter()->supportsApplicationEmail();
  }

  public function getHeraldFieldValue($object) {
    $phids = array();

    $email = $this->getAdapter()->getApplicationEmail();
    if ($email) {
      $phids[] = $email;
    }

    return $phids;
  }

  protected function getHeraldFieldStandardConditions() {
    return self::STANDARD_LIST;
  }

  public function getHeraldFieldValueType($condition) {
    switch ($condition) {
      case HeraldAdapter::CONDITION_EXISTS:
      case HeraldAdapter::CONDITION_NOT_EXISTS:
        return HeraldAdapter::VALUE_NONE;
      default:
        return HeraldAdapter::VALUE_APPLICATION_EMAIL;
    }
  }

}

<?php

final class PhabricatorMetaMTAApplicationEmailHeraldField
  extends HeraldField {

  const FIELDCONST = 'application-email';

  public function getHeraldFieldName() {
    return pht('Receiving email address');
  }

  public function supportsObject($object) {
    return $this->getAdapter()->supportsApplicationEmail();
  }

  public function getHeraldFieldValue($object) {
    $phids = array();

    $email = $this->getAdapter()->getApplicationEmail();
    if ($email) {
      $phids[] = $email->getPHID();
    }

    return $phids;
  }

  protected function getHeraldFieldStandardConditions() {
    return self::STANDARD_LIST;
  }

  public function getHeraldFieldValueType($condition) {
    switch ($condition) {
      case HeraldAdapter::CONDITION_EXISTS:
      case HeraldAdapter::CONDITION_NOT_EXISTS:
        return HeraldAdapter::VALUE_NONE;
      default:
        return HeraldAdapter::VALUE_APPLICATION_EMAIL;
    }
  }

}

Fix a typo in the new "ApplicationEmailHeraldField"
Fix a typo in the new "ApplicationEmailHeraldField"

Summary: This rule isn't quite right.

Test Plan: Shipped email in with a rule in effect, saw correct value in transcript.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

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