mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Create metamta.user-address-format configuration option
Summary: this lets users specify what "name" to use in email addresses Test Plan: changed the conf setting in my local instance and used phabricator. observed name format changes Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1862 Differential Revision: https://secure.phabricator.com/D3639
This commit is contained in:
parent
c4aaa7291b
commit
a754fdfca3
2 changed files with 35 additions and 1 deletions
|
@ -320,6 +320,14 @@ return array(
|
||||||
// configuration a little easier.
|
// configuration a little easier.
|
||||||
'metamta.send-immediately' => true,
|
'metamta.send-immediately' => true,
|
||||||
|
|
||||||
|
// When email is sent, what format should Phabricator use for user's
|
||||||
|
// email addresses? Valid values are:
|
||||||
|
// - 'short' - 'gwashington <gwashington@example.com>'
|
||||||
|
// - 'real' - 'George Washington <gwashington@example.com>'
|
||||||
|
// - 'full' - 'gwashington (George Washington) <gwashington@example.com>'
|
||||||
|
// The default is 'full'.
|
||||||
|
'metamta.user-address-format' => 'full',
|
||||||
|
|
||||||
// If you're using Amazon SES to send email, provide your AWS access key
|
// If you're using Amazon SES to send email, provide your AWS access key
|
||||||
// and AWS secret key here. To set up Amazon SES with Phabricator, you need
|
// and AWS secret key here. To set up Amazon SES with Phabricator, you need
|
||||||
// to:
|
// to:
|
||||||
|
|
|
@ -758,7 +758,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_USER:
|
case PhabricatorPHIDConstants::PHID_TYPE_USER:
|
||||||
$user = $users[$phid];
|
$user = $users[$phid];
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$name = $user->getFullName();
|
$name = $this->getUserName($user);
|
||||||
$is_mailable = !$user->getIsDisabled()
|
$is_mailable = !$user->getIsDisabled()
|
||||||
&& !$user->getIsSystemAgent();
|
&& !$user->getIsSystemAgent();
|
||||||
}
|
}
|
||||||
|
@ -783,6 +783,32 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Small helper function to make sure we format the username properly as
|
||||||
|
* specified by the `metamta.user-address-format` configuration value.
|
||||||
|
*/
|
||||||
|
private function getUserName($user) {
|
||||||
|
$format = PhabricatorEnv::getEnvConfig(
|
||||||
|
'metamta.user-address-format',
|
||||||
|
'full'
|
||||||
|
);
|
||||||
|
|
||||||
|
switch ($format) {
|
||||||
|
case 'short':
|
||||||
|
$name = $user->getUserName();
|
||||||
|
break;
|
||||||
|
case 'real':
|
||||||
|
$name = $user->getRealName();
|
||||||
|
break;
|
||||||
|
case 'full':
|
||||||
|
default:
|
||||||
|
$name = $user->getFullName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
private function filterSendable($value, $phids, $exclude) {
|
private function filterSendable($value, $phids, $exclude) {
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($value as $phid) {
|
foreach ($value as $phid) {
|
||||||
|
|
Loading…
Reference in a new issue