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:
@@ -71,6 +71,32 @@ class DifferentialCommentMail extends DifferentialMail {
|
|||||||
$body = array();
|
$body = array();
|
||||||
|
|
||||||
$body[] = "{$actor} has {$verb} the revision \"{$name}\".";
|
$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;
|
$body[] = null;
|
||||||
|
|
||||||
$content = $comment->getContent();
|
$content = $comment->getContent();
|
||||||
@@ -134,4 +160,12 @@ class DifferentialCommentMail extends DifferentialMail {
|
|||||||
|
|
||||||
return implode("\n", $body);
|
return implode("\n", $body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function renderHandleList(array $handles, array $phids) {
|
||||||
|
$names = array();
|
||||||
|
foreach ($phids as $phid) {
|
||||||
|
$names[] = $handles[$phid]->getName();
|
||||||
|
}
|
||||||
|
return implode(', ', $names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
phutil_require_module('phabricator', 'applications/differential/constants/action');
|
phutil_require_module('phabricator', 'applications/differential/constants/action');
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
|
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
|
||||||
phutil_require_module('phabricator', 'applications/differential/mail/base');
|
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', 'applications/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'infrastructure/env');
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user