Page MenuHomePhabricator

D13499.diff
No OneTemporary

D13499.diff

diff --git a/resources/sql/autopatches/20150630.herald.1.sql b/resources/sql/autopatches/20150630.herald.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150630.herald.1.sql
@@ -0,0 +1,5 @@
+# NOTE: This is a spelling correction.
+
+UPDATE {$NAMESPACE}_herald.herald_condition
+ SET fieldName = 'application-email'
+ WHERE fieldName = 'applicaton-email';
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2112,6 +2112,7 @@
'PhabricatorMetaMTAApplicationEmail' => 'applications/metamta/storage/PhabricatorMetaMTAApplicationEmail.php',
'PhabricatorMetaMTAApplicationEmailDatasource' => 'applications/metamta/typeahead/PhabricatorMetaMTAApplicationEmailDatasource.php',
'PhabricatorMetaMTAApplicationEmailEditor' => 'applications/metamta/editor/PhabricatorMetaMTAApplicationEmailEditor.php',
+ 'PhabricatorMetaMTAApplicationEmailHeraldField' => 'applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php',
'PhabricatorMetaMTAApplicationEmailPHIDType' => 'applications/phid/PhabricatorMetaMTAApplicationEmailPHIDType.php',
'PhabricatorMetaMTAApplicationEmailPanel' => 'applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php',
'PhabricatorMetaMTAApplicationEmailQuery' => 'applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php',
@@ -5800,6 +5801,7 @@
),
'PhabricatorMetaMTAApplicationEmailDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorMetaMTAApplicationEmailEditor' => 'PhabricatorApplicationTransactionEditor',
+ 'PhabricatorMetaMTAApplicationEmailHeraldField' => 'HeraldField',
'PhabricatorMetaMTAApplicationEmailPHIDType' => 'PhabricatorPHIDType',
'PhabricatorMetaMTAApplicationEmailPanel' => 'PhabricatorApplicationConfigurationPanel',
'PhabricatorMetaMTAApplicationEmailQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -29,7 +29,6 @@
const FIELD_BRANCHES = 'branches';
const FIELD_AUTHOR_RAW = 'author-raw';
const FIELD_COMMITTER_RAW = 'committer-raw';
- const FIELD_APPLICATION_EMAIL = 'applicaton-email';
const FIELD_TASK_PRIORITY = 'taskpriority';
const FIELD_TASK_STATUS = 'taskstatus';
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer';
@@ -164,6 +163,10 @@
return $this;
}
+ public function supportsApplicationEmail() {
+ return false;
+ }
+
public function setApplicationEmail(
PhabricatorMetaMTAApplicationEmail $email) {
$this->applicationEmail = $email;
@@ -183,18 +186,7 @@
return $impl->getHeraldFieldValue($this->getObject());
}
- switch ($field_name) {
- case self::FIELD_APPLICATION_EMAIL:
- $value = array();
- // while there is only one match by implementation, we do set
- // comparisons on phids, so return an array with just the phid
- if ($this->getApplicationEmail()) {
- $value[] = $this->getApplicationEmail()->getPHID();
- }
- return $value;
- default:
- throw new Exception(pht("Unknown field '%s'!", $field_name));
- }
+ throw new Exception(pht("Unknown field '%s'!", $field_name));
}
abstract public function applyHeraldEffects(array $effects);
@@ -391,7 +383,6 @@
self::FIELD_BRANCHES => pht('Commit\'s branches'),
self::FIELD_AUTHOR_RAW => pht('Raw author name'),
self::FIELD_COMMITTER_RAW => pht('Raw committer name'),
- self::FIELD_APPLICATION_EMAIL => pht('Receiving email address'),
self::FIELD_TASK_PRIORITY => pht('Task priority'),
self::FIELD_TASK_STATUS => pht('Task status'),
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'),
@@ -481,13 +472,6 @@
self::CONDITION_EXISTS,
self::CONDITION_NOT_EXISTS,
);
- case self::FIELD_APPLICATION_EMAIL:
- return array(
- self::CONDITION_INCLUDE_ANY,
- self::CONDITION_INCLUDE_NONE,
- self::CONDITION_EXISTS,
- self::CONDITION_NOT_EXISTS,
- );
case self::FIELD_DIFF_FILE:
case self::FIELD_BRANCHES:
return array(
@@ -944,8 +928,6 @@
return self::VALUE_PROJECT;
case self::FIELD_REVIEWERS:
return self::VALUE_USER_OR_PROJECT;
- case self::FIELD_APPLICATION_EMAIL:
- return self::VALUE_APPLICATION_EMAIL;
default:
return self::VALUE_USER;
}
diff --git a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
--- a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
+++ b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
@@ -21,6 +21,10 @@
$this->task = $this->newObject();
}
+ public function supportsApplicationEmail() {
+ return true;
+ }
+
public function getRepetitionOptions() {
return array(
HeraldRepetitionPolicyConfig::EVERY,
@@ -72,7 +76,6 @@
self::FIELD_ASSIGNEE,
self::FIELD_TASK_PRIORITY,
self::FIELD_TASK_STATUS,
- self::FIELD_APPLICATION_EMAIL,
),
parent::getFields());
}
diff --git a/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php b/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php
@@ -0,0 +1,41 @@
+<?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;
+ }
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 3:54 PM (9 h, 8 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6942849
Default Alt Text
D13499.diff (6 KB)

Event Timeline