diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index c0208603c0..a21bbf9794 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -364,6 +364,10 @@ final class DifferentialTransactionEditor $diff->setRevisionID($object->getID()); $diff->save(); + + $object->setLineCount($diff->getLineCount()); + $object->setRepositoryPHID($diff->getRepositoryPHID()); + return; } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 61269ccff4..38f5e626ca 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -87,6 +87,69 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { 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() { $author_phid = $this->getAuthorPHID(); $author_handle = $this->renderHandleLink($author_phid); diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php index 030963e150..35d5e57e72 100644 --- a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php @@ -99,6 +99,11 @@ final class PhabricatorMailImplementationMailgunAdapter $params['cc'] = $this->params['ccs']; } + foreach (idx($this->params, 'headers', array()) as $header) { + list($name, $value) = $header; + $params['h:'.$name] = $value; + } + $future = new HTTPSFuture( "https://api:{$key}@api.mailgun.net/v2/{$domain}/messages", $params);