mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 02:40:58 +01:00
Add a 'silent' option to diffusion.createcomment
Test Plan: Created comments with 'silent' both true and empty, received notifcation for only the latter. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7916
This commit is contained in:
parent
982e0d78ae
commit
6639f93153
2 changed files with 12 additions and 1 deletions
|
@ -8,6 +8,8 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
private $auditors = array();
|
private $auditors = array();
|
||||||
private $ccs = array();
|
private $ccs = array();
|
||||||
|
|
||||||
|
private $noEmail;
|
||||||
|
|
||||||
public function __construct(PhabricatorRepositoryCommit $commit) {
|
public function __construct(PhabricatorRepositoryCommit $commit) {
|
||||||
$this->commit = $commit;
|
$this->commit = $commit;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -28,6 +30,11 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setNoEmail($no_email) {
|
||||||
|
$this->noEmail = $no_email;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function addComment(PhabricatorAuditComment $comment) {
|
public function addComment(PhabricatorAuditComment $comment) {
|
||||||
|
|
||||||
$commit = $this->commit;
|
$commit = $this->commit;
|
||||||
|
@ -297,8 +304,10 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
id(new PhabricatorSearchIndexer())
|
id(new PhabricatorSearchIndexer())
|
||||||
->indexDocumentByPHID($commit->getPHID());
|
->indexDocumentByPHID($commit->getPHID());
|
||||||
|
|
||||||
|
if (!$this->noEmail) {
|
||||||
$this->sendMail($comment, $other_comments, $inline_comments, $requests);
|
$this->sendMail($comment, $other_comments, $inline_comments, $requests);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ final class ConduitAPI_diffusion_createcomment_Method
|
||||||
'phid' => 'required string',
|
'phid' => 'required string',
|
||||||
'action' => 'optional string',
|
'action' => 'optional string',
|
||||||
'message' => 'required string',
|
'message' => 'required string',
|
||||||
|
'silent' => 'optional bool',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ final class ConduitAPI_diffusion_createcomment_Method
|
||||||
|
|
||||||
id(new PhabricatorAuditCommentEditor($commit))
|
id(new PhabricatorAuditCommentEditor($commit))
|
||||||
->setActor($request->getUser())
|
->setActor($request->getUser())
|
||||||
|
->setNoEmail($request->getValue('silent'))
|
||||||
->addComment($comment);
|
->addComment($comment);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue