Page MenuHomePhabricator

D10146.id24413.diff
No OneTemporary

D10146.id24413.diff

diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -294,6 +294,21 @@
'Normally, inline comments in emails are shown with a file and '.
'line but without any diff context. Enabling this option adds '.
'diff context.')),
+ $this->newOption(
+ 'metamta.differential.comment-thread',
+ 'bool',
+ false)
+ ->setBoolOptions(
+ array(
+ pht('Show comment thread'),
+ pht('Do not show comment thread'),
+ ))
+ ->setSummary(pht('Show comment thread around inline comments.'))
+ ->setDescription(
+ pht(
+ 'Normally, inline comments in emails do not include the full '.
+ 'comment thread. Enabling this option adds the full history of '.
+ 'the conversation for each inline comment.')),
);
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -1277,6 +1277,34 @@
return $result;
}
+ protected function indentForMail($lines) {
+ foreach ($lines as &$line) {
+ $line = '> '.$line;
+ }
+ return $lines;
+ }
+
+ protected function nestCommentHistory($inline) {
+ $nested = array();
+ $previous_inlines = id(new DifferentialTransactionComment())->loadAllWhere(
+ 'changesetID = %d AND lineNumber = %d AND id < %d '.
+ 'ORDER BY id ASC',
+ $inline->getChangesetID(), $inline->getLineNumber(), $inline->getID());
+ foreach ($previous_inlines as $previous_inline) {
+ $nested = $this->indentForMail(
+ array_merge(
+ $nested,
+ explode("\n", $previous_inline->getContent())));
+ $user = id(new PhabricatorUser())->loadOneWhere(
+ 'phid = %s', $previous_inline->getAuthorPHID());
+ if ($user) {
+ array_unshift($nested, $user->getRealName().' wrote:');
+ }
+ }
+ $nested = array_merge($nested, explode("\n", $inline->getContent()));
+ return implode("\n", $nested);
+ }
+
private function renderInlineCommentsForMail(
PhabricatorLiskDAO $object,
array $inlines) {
@@ -1337,7 +1365,12 @@
1);
$result[] = '----------------';
- $result[] = $inline_content;
+ if (PhabricatorEnv::getEnvConfig(
+ 'metamta.differential.comment-thread', false)) {
+ $result[] = $this->nestCommentHistory($inline->getComment());
+ } else {
+ $result[] = $inline_content;
+ }
$result[] = null;
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 18, 6:19 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9039174
Default Alt Text
D10146.id24413.diff (2 KB)

Event Timeline