mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Add a 'silent' option to differential.createcomment
Summary: See T1677. I think wanting bots to be able to post comments without sending email is a pretty reasonable use case. Eventually we should probably support this more broadly and maybe protect it with permissions (normal users maybe shouldn't be able to do this?) but we can wait for use cases. Test Plan: Made comments with and without "silent". Verified that the non-silent comment sent email, and the silent comment did not. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T1677 Differential Revision: https://secure.phabricator.com/D3341
This commit is contained in:
parent
21ebd1a609
commit
6ed202b675
2 changed files with 25 additions and 15 deletions
|
@ -31,6 +31,7 @@ final class ConduitAPI_differential_createcomment_Method
|
||||||
'revision_id' => 'required revisionid',
|
'revision_id' => 'required revisionid',
|
||||||
'message' => 'optional string',
|
'message' => 'optional string',
|
||||||
'action' => 'optional string',
|
'action' => 'optional string',
|
||||||
|
'silent' => 'optional bool',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ final class ConduitAPI_differential_createcomment_Method
|
||||||
$action);
|
$action);
|
||||||
$editor->setContentSource($content_source);
|
$editor->setContentSource($content_source);
|
||||||
$editor->setMessage($request->getValue('message'));
|
$editor->setMessage($request->getValue('message'));
|
||||||
|
$editor->setNoEmail($request->getValue('silent'));
|
||||||
$editor->save();
|
$editor->save();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -31,6 +31,7 @@ final class DifferentialCommentEditor {
|
||||||
|
|
||||||
private $parentMessageID;
|
private $parentMessageID;
|
||||||
private $contentSource;
|
private $contentSource;
|
||||||
|
private $noEmail;
|
||||||
|
|
||||||
private $isDaemonWorkflow;
|
private $isDaemonWorkflow;
|
||||||
|
|
||||||
|
@ -105,6 +106,11 @@ final class DifferentialCommentEditor {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setNoEmail($no_email) {
|
||||||
|
$this->noEmail = $no_email;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
$revision = $this->revision;
|
$revision = $this->revision;
|
||||||
$action = $this->action;
|
$action = $this->action;
|
||||||
|
@ -553,6 +559,7 @@ final class DifferentialCommentEditor {
|
||||||
$xherald_header = HeraldTranscript::loadXHeraldRulesHeader(
|
$xherald_header = HeraldTranscript::loadXHeraldRulesHeader(
|
||||||
$revision->getPHID());
|
$revision->getPHID());
|
||||||
|
|
||||||
|
if (!$this->noEmail) {
|
||||||
id(new DifferentialCommentMail(
|
id(new DifferentialCommentMail(
|
||||||
$revision,
|
$revision,
|
||||||
$actor_handle,
|
$actor_handle,
|
||||||
|
@ -568,6 +575,7 @@ final class DifferentialCommentEditor {
|
||||||
->setXHeraldRulesHeader($xherald_header)
|
->setXHeraldRulesHeader($xherald_header)
|
||||||
->setParentMessageID($this->parentMessageID)
|
->setParentMessageID($this->parentMessageID)
|
||||||
->send();
|
->send();
|
||||||
|
}
|
||||||
|
|
||||||
$event_data = array(
|
$event_data = array(
|
||||||
'revision_id' => $revision->getID(),
|
'revision_id' => $revision->getID(),
|
||||||
|
|
Loading…
Reference in a new issue