From 5cf6d788ced2c8b147c8018919455a71e40159eb Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 13 Jan 2012 22:22:27 -0800 Subject: [PATCH] Don't add author and reviewers to CCs Summary: Commenting on a diff causes adding the writer to the CCs. It doesn't make much sense if the writer is author or reviewer who get all the copies anyway. I've also moved the decision to DifferentialCommentEditor. Test Plan: Comment on a diff where I am author Comment on a diff where I am reviewer Comment on a diff where I am neither Explicitely Add CCs where I am author Reviewers: epriestley Reviewed By: epriestley CC: jungejason, aran, epriestley Differential Revision: https://secure.phabricator.com/D1397 --- .../commentsave/DifferentialCommentSaveController.php | 3 +-- .../differential/controller/commentsave/__init__.php | 1 - .../editor/comment/DifferentialCommentEditor.php | 10 +++------- .../replyhandler/DifferentialReplyHandler.php | 3 +-- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/applications/differential/controller/commentsave/DifferentialCommentSaveController.php b/src/applications/differential/controller/commentsave/DifferentialCommentSaveController.php index 9f589951c9..4363f666cd 100644 --- a/src/applications/differential/controller/commentsave/DifferentialCommentSaveController.php +++ b/src/applications/differential/controller/commentsave/DifferentialCommentSaveController.php @@ -1,7 +1,7 @@ setMessage($comment) ->setContentSource($content_source) ->setAttachInlineComments(true) - ->setAddCC($action != DifferentialAction::ACTION_RESIGN) ->setAddedReviewers($reviewers) ->setAddedCCs($ccs) ->save(); diff --git a/src/applications/differential/controller/commentsave/__init__.php b/src/applications/differential/controller/commentsave/__init__.php index 7392c007a0..e0f7759809 100644 --- a/src/applications/differential/controller/commentsave/__init__.php +++ b/src/applications/differential/controller/commentsave/__init__.php @@ -8,7 +8,6 @@ phutil_require_module('phabricator', 'aphront/response/400'); phutil_require_module('phabricator', 'aphront/response/redirect'); -phutil_require_module('phabricator', 'applications/differential/constants/action'); phutil_require_module('phabricator', 'applications/differential/controller/base'); phutil_require_module('phabricator', 'applications/differential/editor/comment'); phutil_require_module('phabricator', 'applications/differential/storage/revision'); diff --git a/src/applications/differential/editor/comment/DifferentialCommentEditor.php b/src/applications/differential/editor/comment/DifferentialCommentEditor.php index 14545650df..afcd5de26e 100644 --- a/src/applications/differential/editor/comment/DifferentialCommentEditor.php +++ b/src/applications/differential/editor/comment/DifferentialCommentEditor.php @@ -24,7 +24,6 @@ class DifferentialCommentEditor { protected $attachInlineComments; protected $message; - protected $addCC; protected $changedByCommit; protected $addedReviewers = array(); private $addedCCs = array(); @@ -57,11 +56,6 @@ class DifferentialCommentEditor { return $this; } - public function setAddCC($add) { - $this->addCC = $add; - return $this; - } - public function setChangedByCommit($changed_by_commit) { $this->changedByCommit = $changed_by_commit; return $this; @@ -315,7 +309,9 @@ class DifferentialCommentEditor { // top of the action list. $revision->save(); - if ($this->addCC) { + if ($action != DifferentialAction::ACTION_RESIGN && + $this->actorPHID != $revision->getAuthorPHID() && + !in_array($this->actorPHID, $revision->getReviewers())) { DifferentialRevisionEditor::addCC( $revision, $this->actorPHID, diff --git a/src/applications/differential/replyhandler/DifferentialReplyHandler.php b/src/applications/differential/replyhandler/DifferentialReplyHandler.php index 7146b45d9f..b16dbde854 100644 --- a/src/applications/differential/replyhandler/DifferentialReplyHandler.php +++ b/src/applications/differential/replyhandler/DifferentialReplyHandler.php @@ -1,7 +1,7 @@ setParentMessageID($this->receivedMail->getMessageID()); } $editor->setMessage($body); - $editor->setAddCC(($command != DifferentialAction::ACTION_RESIGN)); $comment = $editor->save(); return $comment->getID();