mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
Audit - add mail tags
Summary: Fixes T2497. I'm not sure where we are with subscribers and custom vs normal codepath, but the mailtags implementation makes no assumptions and can handle it either way. Test Plan: made a commit and got some sensible mail tags Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T2497 Differential Revision: https://secure.phabricator.com/D10712
This commit is contained in:
parent
758dfe6c98
commit
ac83ff7060
2 changed files with 89 additions and 0 deletions
|
@ -702,6 +702,33 @@ final class PhabricatorAuditEditor
|
|||
return implode("\n", $block);
|
||||
}
|
||||
|
||||
public function getMailTagsMap() {
|
||||
return array(
|
||||
PhabricatorAuditTransaction::MAILTAG_COMMIT =>
|
||||
pht('A commit is created.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_CONCERN =>
|
||||
pht('A commit has a concerned raised against it.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_ACCEPT =>
|
||||
pht('A commit is accepted.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_RESIGN =>
|
||||
pht('A commit has an auditor resign.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_CLOSE =>
|
||||
pht('A commit is closed.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ADD_AUDITORS =>
|
||||
pht('A commit has auditors added.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ADD_CCS =>
|
||||
pht("A commit's subscribers change."),
|
||||
PhabricatorAuditTransaction::MAILTAG_PROJECTS =>
|
||||
pht("A commit's projects change."),
|
||||
PhabricatorAuditTransaction::MAILTAG_COMMENT =>
|
||||
pht('Someone comments on a commit.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_OTHER =>
|
||||
pht('Other commit activity not listed above occurs.'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function shouldPublishFeedStory(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
|
|
@ -5,6 +5,17 @@ final class PhabricatorAuditTransaction
|
|||
|
||||
const TYPE_COMMIT = 'audit:commit';
|
||||
|
||||
const MAILTAG_ACTION_CONCERN = 'audit-action-concern';
|
||||
const MAILTAG_ACTION_ACCEPT = 'audit-action-accept';
|
||||
const MAILTAG_ACTION_RESIGN = 'audit-action-resign';
|
||||
const MAILTAG_ACTION_CLOSE = 'audit-action-close';
|
||||
const MAILTAG_ADD_AUDITORS = 'audit-add-auditors';
|
||||
const MAILTAG_ADD_CCS = 'audit-add-ccs';
|
||||
const MAILTAG_COMMENT = 'audit-comment';
|
||||
const MAILTAG_COMMIT = 'audit-commit';
|
||||
const MAILTAG_PROJECTS = 'audit-projects';
|
||||
const MAILTAG_OTHER = 'audit-other';
|
||||
|
||||
public function getApplicationName() {
|
||||
return 'audit';
|
||||
}
|
||||
|
@ -403,4 +414,55 @@ final class PhabricatorAuditTransaction
|
|||
return parent::getBodyForMail();
|
||||
}
|
||||
|
||||
public function getMailTags() {
|
||||
$tags = array();
|
||||
switch ($this->getTransactionType()) {
|
||||
case PhabricatorAuditActionConstants::ACTION:
|
||||
switch ($this->getNewValue()) {
|
||||
case PhabricatorAuditActionConstants::CONCERN:
|
||||
$tags[] = self::MAILTAG_ACTION_CONCERN;
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::ACCEPT:
|
||||
$tags[] = self::MAILTAG_ACTION_ACCEPT;
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::RESIGN:
|
||||
$tags[] = self::MAILTAG_ACTION_RESIGN;
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::CLOSE:
|
||||
$tags[] = self::MAILTAG_ACTION_CLOSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::ADD_AUDITORS:
|
||||
$tags[] = self::MAILTAG_ADD_AUDITORS;
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::ADD_CCS:
|
||||
$tags[] = self::MAILTAG_ADD_CCS;
|
||||
break;
|
||||
case PhabricatorAuditActionConstants::INLINE:
|
||||
case PhabricatorTransactions::TYPE_COMMENT:
|
||||
$tags[] = self::MAILTAG_COMMENT;
|
||||
break;
|
||||
case self::TYPE_COMMIT:
|
||||
$tags[] = self::MAILTAG_COMMIT;
|
||||
break;
|
||||
case PhabricatorTransactions::TYPE_EDGE:
|
||||
switch ($this->getMetadataValue('edge:type')) {
|
||||
case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
|
||||
$tags[] = self::MAILTAG_PROJECTS;
|
||||
break;
|
||||
case PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
$tags[] = self::MAILTAG_ADD_CCS;
|
||||
break;
|
||||
default:
|
||||
$tags[] = self::MAILTAG_OTHER;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$tags[] = self::MAILTAG_OTHER;
|
||||
break;
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue