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

Add repository to audit emails

Summary: This is vaguely related to T5791. Add a "REPOSITORY" header to audit emails so that they can be filtered in Gmail.

Test Plan: Commented on an audit and used `./bin/mail show-outbound` to inspect outbound email.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: fabe, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12997
This commit is contained in:
Joshua Spence 2015-05-25 22:43:42 +10:00
parent 6079629038
commit be19b31a64
3 changed files with 38 additions and 4 deletions

View file

@ -1542,6 +1542,7 @@ phutil_register_library_map(array(
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
'PhabricatorCommitMergedCommitsField' => 'applications/repository/customfield/PhabricatorCommitMergedCommitsField.php',
'PhabricatorCommitRepositoryField' => 'applications/repository/customfield/PhabricatorCommitRepositoryField.php',
'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php',
'PhabricatorCommitTagsField' => 'applications/repository/customfield/PhabricatorCommitTagsField.php',
'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php',
@ -4908,6 +4909,7 @@ phutil_register_library_map(array(
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
'PhabricatorCommitMergedCommitsField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitRepositoryField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorCommitTagsField' => 'PhabricatorCommitCustomField',
'PhabricatorCommonPasswords' => 'Phobject',

View file

@ -23,6 +23,7 @@ final class PhabricatorDiffusionConfigOptions
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
$fields = array(
new PhabricatorCommitRepositoryField(),
new PhabricatorCommitBranchesField(),
new PhabricatorCommitTagsField(),
new PhabricatorCommitMergedCommitsField(),
@ -142,10 +143,11 @@ final class PhabricatorDiffusionConfigOptions
$this->newOption('diffusion.fields', $custom_field_type, $default_fields)
->setCustomData(
id(new PhabricatorRepositoryCommit())
->getCustomFieldBaseClass())
->setDescription(pht(
"Select and reorder diffusion fields.\n\n".
"These will primarily show up in Mail Notifications.")),
->getCustomFieldBaseClass())
->setDescription(
pht(
"Select and reorder diffusion fields.\n\n".
"These will primarily show up in Mail Notifications.")),
);
}

View file

@ -0,0 +1,30 @@
<?php
final class PhabricatorCommitRepositoryField
extends PhabricatorCommitCustomField {
public function getFieldKey() {
return 'diffusion:repository';
}
public function shouldDisableByDefault() {
return true;
}
public function shouldAppearInTransactionMail() {
return true;
}
public function updateTransactionMailBody(
PhabricatorMetaMTAMailBody $body,
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
$repository = $this->getObject()->getRepository();
$body->addTextSection(
pht('REPOSITORY'),
$repository->getMonogram().' '.$repository->getName());
}
}