1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

When sending Differential comment emails, include added CCs and reviewers

explicitly

Summary: You currently have to click through to figure out who got added.
Test Plan:
  - Made a comment which added CCs.
  - Made a comment which added reviewers.
  - Made a comment which added nothing.
  - Made a comment which added CCs and reviewers.

Reviewed By: tomo
Reviewers: tomo, jungejason, tuomaspelkonen, aran
CC: aran, tomo
Differential Revision: 562
This commit is contained in:
epriestley 2011-06-30 12:32:30 -07:00
parent f6c3a902b5
commit 553ef6f587
2 changed files with 35 additions and 0 deletions

View file

@ -71,6 +71,32 @@ class DifferentialCommentMail extends DifferentialMail {
$body = array();
$body[] = "{$actor} has {$verb} the revision \"{$name}\".";
// If the commented added reviewers or CCs, list them explicitly.
$meta = $comment->getMetadata();
$m_reviewers = idx(
$meta,
DifferentialComment::METADATA_ADDED_REVIEWERS,
array());
$m_cc = idx(
$meta,
DifferentialComment::METADATA_ADDED_CCS,
array());
$load = array_merge($m_reviewers, $m_cc);
if ($load) {
$handles = id(new PhabricatorObjectHandleData($load))->loadHandles();
if ($m_reviewers) {
$body[] = 'Added Reviewers: '.$this->renderHandleList(
$handles,
$m_reviewers);
}
if ($m_cc) {
$body[] = 'Added CCs: '.$this->renderHandleList(
$handles,
$m_cc);
}
}
$body[] = null;
$content = $comment->getContent();
@ -134,4 +160,12 @@ class DifferentialCommentMail extends DifferentialMail {
return implode("\n", $body);
}
private function renderHandleList(array $handles, array $phids) {
$names = array();
foreach ($phids as $phid) {
$names[] = $handles[$phid]->getName();
}
return implode(', ', $names);
}
}

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'applications/differential/constants/action');
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
phutil_require_module('phabricator', 'applications/differential/mail/base');
phutil_require_module('phabricator', 'applications/differential/storage/comment');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'infrastructure/env');