1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Clean up some Differential behaviors

Summary:
Ref T2222.

  - Restore mail tags for ApplicationTransactions mail.
  - Restore subject line verbs.
  - Denormalize line count and repository PHID.
  - Fix an issue with the mailgun adapter where headers weren't attached properly.

Test Plan: Sent some mail, verified it had correct subjects and tags.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222

Differential Revision: https://secure.phabricator.com/D8378
This commit is contained in:
epriestley 2014-03-03 08:36:40 -08:00
parent e556d20577
commit 83206242c9
3 changed files with 72 additions and 0 deletions

View file

@ -364,6 +364,10 @@ final class DifferentialTransactionEditor
$diff->setRevisionID($object->getID()); $diff->setRevisionID($object->getID());
$diff->save(); $diff->save();
$object->setLineCount($diff->getLineCount());
$object->setRepositoryPHID($diff->getRepositoryPHID());
return; return;
} }

View file

@ -87,6 +87,69 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
return $phids; return $phids;
} }
public function getActionName() {
switch ($this->getTransactionType()) {
case self::TYPE_INLINE:
return pht('Commented On');
case self::TYPE_UPDATE:
return pht('Updated');
case self::TYPE_ACTION:
$map = array(
DifferentialAction::ACTION_ACCEPT => pht('Accepted'),
DifferentialAction::ACTION_REJECT => pht('Requested Changes To'),
DifferentialAction::ACTION_RETHINK => pht('Planned Changes To'),
DifferentialAction::ACTION_ABANDON => pht('Abandoned'),
DifferentialAction::ACTION_CLOSE => pht('Closed'),
DifferentialAction::ACTION_REQUEST => pht('Requested A Review Of'),
DifferentialAction::ACTION_RESIGN => pht('Resigned From'),
DifferentialAction::ACTION_ADDREVIEWERS => pht('Added Reviewers'),
DifferentialAction::ACTION_CLAIM => pht('Commandeered'),
DifferentialAction::ACTION_REOPEN => pht('Reopened'),
);
$name = idx($map, $this->getNewValue());
if ($name !== null) {
return $name;
}
break;
}
return parent::getActionName();
}
public function getMailTags() {
$tags = array();
switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_SUBSCRIBERS;
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC;
break;
case self::TYPE_ACTION:
switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED;
break;
}
break;
case PhabricatorTransactions::TYPE_EDGE:
switch ($this->getMetadataValue('edge:type')) {
case PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
break;
}
break;
case PhabricatorTransactions::TYPE_COMMENT:
case self::TYPE_INLINE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT;
break;
}
if (!$tags) {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER;
}
return $tags;
}
public function getTitle() { public function getTitle() {
$author_phid = $this->getAuthorPHID(); $author_phid = $this->getAuthorPHID();
$author_handle = $this->renderHandleLink($author_phid); $author_handle = $this->renderHandleLink($author_phid);

View file

@ -99,6 +99,11 @@ final class PhabricatorMailImplementationMailgunAdapter
$params['cc'] = $this->params['ccs']; $params['cc'] = $this->params['ccs'];
} }
foreach (idx($this->params, 'headers', array()) as $header) {
list($name, $value) = $header;
$params['h:'.$name] = $value;
}
$future = new HTTPSFuture( $future = new HTTPSFuture(
"https://api:{$key}@api.mailgun.net/v2/{$domain}/messages", "https://api:{$key}@api.mailgun.net/v2/{$domain}/messages",
$params); $params);