Page MenuHomePhabricator

D8199.id.diff
No OneTemporary

D8199.id.diff

Index: src/applications/differential/editor/DifferentialCommentEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialCommentEditor.php
+++ src/applications/differential/editor/DifferentialCommentEditor.php
@@ -647,7 +647,7 @@
$mail = id(new DifferentialCommentMail(
$revision,
$actor_handle,
- $comment,
+ array($comment),
$changesets,
$inline_comments))
->setActor($actor)
Index: src/applications/differential/editor/DifferentialRevisionEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialRevisionEditor.php
+++ src/applications/differential/editor/DifferentialRevisionEditor.php
@@ -381,24 +381,21 @@
$actor_handle = $handles[$this->getActorPHID()];
$changesets = null;
- $comment = null;
$old_status = $revision->getStatus();
if ($diff) {
$changesets = $diff->loadChangesets();
// TODO: This should probably be in DifferentialFeedbackEditor?
if (!$is_new) {
- $comment = $this->createComment();
- }
- if ($comment) {
+ $this->createComment();
$mail[] = id(new DifferentialNewDiffMail(
$revision,
$actor_handle,
$changesets))
->setActor($this->getActor())
- ->setIsFirstMailAboutRevision($is_new)
- ->setIsFirstMailToRecipients($is_new)
- ->setComments($this->getComments())
+ ->setIsFirstMailAboutRevision(false)
+ ->setIsFirstMailToRecipients(false)
+ ->setCommentText($this->getComments())
->setToPHIDs(array_keys($stable['rev']))
->setCCPHIDs(array_keys($stable['ccs']));
}
@@ -804,8 +801,6 @@
}
$comment->save();
-
- return $comment;
}
private function updateAuxiliaryFields() {
Index: src/applications/differential/mail/DifferentialCommentMail.php
===================================================================
--- src/applications/differential/mail/DifferentialCommentMail.php
+++ src/applications/differential/mail/DifferentialCommentMail.php
@@ -19,56 +19,60 @@
public function __construct(
DifferentialRevision $revision,
PhabricatorObjectHandle $actor,
- DifferentialComment $comment,
+ array $comments,
array $changesets,
array $inline_comments) {
+
+ assert_instances_of($comments, 'DifferentialComment');
assert_instances_of($changesets, 'DifferentialChangeset');
assert_instances_of($inline_comments, 'PhabricatorInlineCommentInterface');
$this->setRevision($revision);
$this->setActorHandle($actor);
- $this->setComment($comment);
+ $this->setComments($comments);
$this->setChangesets($changesets);
$this->setInlineComments($inline_comments);
}
protected function getMailTags() {
- $tags = array();
- $comment = $this->getComment();
- $action = $comment->getAction();
-
- switch ($action) {
- case DifferentialAction::ACTION_ADDCCS:
- $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC;
- break;
- case DifferentialAction::ACTION_CLOSE:
- $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED;
- break;
- case DifferentialAction::ACTION_ADDREVIEWERS:
- $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
- break;
- case DifferentialAction::ACTION_COMMENT:
- // this is a comment which we will check separately below for content
- break;
- default:
- $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER;
- break;
- }
+ $tags = array();
- $has_comment = strlen(trim($comment->getContent()));
- $has_inlines = (bool)$this->getInlineComments();
+ foreach ($this->getComments() as $comment) {
+ $action = $comment->getAction();
- if ($has_comment || $has_inlines) {
switch ($action) {
+ case DifferentialAction::ACTION_ADDCCS:
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC;
+ break;
case DifferentialAction::ACTION_CLOSE:
- // Commit comments are auto-generated and not especially interesting,
- // so don't tag them as having a comment.
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED;
+ break;
+ case DifferentialAction::ACTION_ADDREVIEWERS:
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
+ break;
+ case DifferentialAction::ACTION_COMMENT:
+ // this is a comment which we will check separately below for content
break;
default:
- $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT;
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER;
break;
}
+
+ $has_comment = strlen(trim($comment->getContent()));
+ $has_inlines = (bool)$this->getInlineComments();
+
+ if ($has_comment || $has_inlines) {
+ switch ($action) {
+ case DifferentialAction::ACTION_CLOSE:
+ // Commit comments are auto-generated and not especially
+ // interesting, so don't tag them as having a comment.
+ break;
+ default:
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT;
+ break;
+ }
+ }
}
if (!$tags) {
@@ -84,7 +88,9 @@
}
protected function getVerb() {
- $comment = $this->getComment();
+ // NOTE: Eventually, this will use getStrongestAction() transaction logic.
+ // For now, pick the first comment.
+ $comment = head($this->getComments());
$action = $comment->getAction();
$verb = DifferentialAction::getActionPastTenseVerb($action);
return $verb;
@@ -94,16 +100,22 @@
parent::prepareBody();
// If the commented added reviewers or CCs, list them explicitly.
- $meta = $this->getComment()->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);
+ $load = array();
+ foreach ($this->comments as $comment) {
+ $meta = $comment->getMetadata();
+ $m_reviewers = idx(
+ $meta,
+ DifferentialComment::METADATA_ADDED_REVIEWERS,
+ array());
+ $m_cc = idx(
+ $meta,
+ DifferentialComment::METADATA_ADDED_CCS,
+ array());
+ $load[] = $m_reviewers;
+ $load[] = $m_cc;
+ }
+
+ $load = array_mergev($load);
if ($load) {
$handles = id(new PhabricatorHandleQuery())
->setViewer($this->getActor())
@@ -119,8 +131,10 @@
}
protected function renderBody() {
+ // TODO: This will be ApplicationTransactions eventually, but split the
+ // difference for now.
- $comment = $this->getComment();
+ $comment = head($this->getComments());
$actor = $this->getActorName();
$name = $this->getRevision()->getTitle();
@@ -139,10 +153,12 @@
$body[] = null;
- $content = $comment->getContent();
- if (strlen($content)) {
- $body[] = $this->formatText($content);
- $body[] = null;
+ foreach ($this->getComments() as $comment) {
+ $content = $comment->getContent();
+ if (strlen($content)) {
+ $body[] = $this->formatText($content);
+ $body[] = null;
+ }
}
if ($this->getChangedByCommit()) {
Index: src/applications/differential/mail/DifferentialMail.php
===================================================================
--- src/applications/differential/mail/DifferentialMail.php
+++ src/applications/differential/mail/DifferentialMail.php
@@ -9,7 +9,7 @@
protected $actorHandle;
protected $revision;
- protected $comment;
+ protected $comments;
protected $changesets;
protected $inlineComments;
protected $isFirstMailAboutRevision;
@@ -370,13 +370,13 @@
return "D{$id}: {$title}";
}
- public function setComment($comment) {
- $this->comment = $comment;
+ public function setComments(array $comments) {
+ $this->comments = $comments;
return $this;
}
- public function getComment() {
- return $this->comment;
+ public function getComments() {
+ return $this->comments;
}
public function setChangesets($changesets) {
Index: src/applications/differential/mail/DifferentialReviewRequestMail.php
===================================================================
--- src/applications/differential/mail/DifferentialReviewRequestMail.php
+++ src/applications/differential/mail/DifferentialReviewRequestMail.php
@@ -4,17 +4,17 @@
const MAX_AFFECTED_FILES = 1000;
- protected $comments;
+ protected $commentText;
private $patch;
- public function setComments($comments) {
- $this->comments = $comments;
+ public function setCommentText($comment_text) {
+ $this->commentText = $comment_text;
return $this;
}
- public function getComments() {
- return $this->comments;
+ public function getCommentText() {
+ return $this->commentText;
}
public function __construct(
@@ -46,8 +46,8 @@
$body = array();
if (!$this->isFirstMailToRecipients()) {
- if (strlen($this->getComments())) {
- $body[] = $this->formatText($this->getComments());
+ if (strlen($this->getCommentText())) {
+ $body[] = $this->formatText($this->getCommentText());
$body[] = null;
}
}

File Metadata

Mime Type
text/plain
Expires
May 10 2024, 8:28 AM (5 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6281852
Default Alt Text
D8199.id.diff (9 KB)

Event Timeline