mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +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:
parent
6079629038
commit
be19b31a64
3 changed files with 38 additions and 4 deletions
|
@ -1542,6 +1542,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
|
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
|
||||||
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
|
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
|
||||||
'PhabricatorCommitMergedCommitsField' => 'applications/repository/customfield/PhabricatorCommitMergedCommitsField.php',
|
'PhabricatorCommitMergedCommitsField' => 'applications/repository/customfield/PhabricatorCommitMergedCommitsField.php',
|
||||||
|
'PhabricatorCommitRepositoryField' => 'applications/repository/customfield/PhabricatorCommitRepositoryField.php',
|
||||||
'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php',
|
'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php',
|
||||||
'PhabricatorCommitTagsField' => 'applications/repository/customfield/PhabricatorCommitTagsField.php',
|
'PhabricatorCommitTagsField' => 'applications/repository/customfield/PhabricatorCommitTagsField.php',
|
||||||
'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php',
|
'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php',
|
||||||
|
@ -4908,6 +4909,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
|
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
|
||||||
'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
|
'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
|
||||||
'PhabricatorCommitMergedCommitsField' => 'PhabricatorCommitCustomField',
|
'PhabricatorCommitMergedCommitsField' => 'PhabricatorCommitCustomField',
|
||||||
|
'PhabricatorCommitRepositoryField' => 'PhabricatorCommitCustomField',
|
||||||
'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhabricatorCommitTagsField' => 'PhabricatorCommitCustomField',
|
'PhabricatorCommitTagsField' => 'PhabricatorCommitCustomField',
|
||||||
'PhabricatorCommonPasswords' => 'Phobject',
|
'PhabricatorCommonPasswords' => 'Phobject',
|
||||||
|
|
|
@ -23,6 +23,7 @@ final class PhabricatorDiffusionConfigOptions
|
||||||
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
|
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
|
||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
|
new PhabricatorCommitRepositoryField(),
|
||||||
new PhabricatorCommitBranchesField(),
|
new PhabricatorCommitBranchesField(),
|
||||||
new PhabricatorCommitTagsField(),
|
new PhabricatorCommitTagsField(),
|
||||||
new PhabricatorCommitMergedCommitsField(),
|
new PhabricatorCommitMergedCommitsField(),
|
||||||
|
@ -143,7 +144,8 @@ final class PhabricatorDiffusionConfigOptions
|
||||||
->setCustomData(
|
->setCustomData(
|
||||||
id(new PhabricatorRepositoryCommit())
|
id(new PhabricatorRepositoryCommit())
|
||||||
->getCustomFieldBaseClass())
|
->getCustomFieldBaseClass())
|
||||||
->setDescription(pht(
|
->setDescription(
|
||||||
|
pht(
|
||||||
"Select and reorder diffusion fields.\n\n".
|
"Select and reorder diffusion fields.\n\n".
|
||||||
"These will primarily show up in Mail Notifications.")),
|
"These will primarily show up in Mail Notifications.")),
|
||||||
);
|
);
|
||||||
|
|
|
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue