Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/editor/PhabricatorAuditCommentEditor.php
<?php | <?php | ||||
final class PhabricatorAuditCommentEditor extends PhabricatorEditor { | final class PhabricatorAuditCommentEditor extends PhabricatorEditor { | ||||
private $commit; | private $commit; | ||||
private $attachInlineComments; | private $attachInlineComments; | ||||
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; | ||||
} | } | ||||
public function addAuditors(array $auditor_phids) { | public function addAuditors(array $auditor_phids) { | ||||
$this->auditors = array_merge($this->auditors, $auditor_phids); | $this->auditors = array_merge($this->auditors, $auditor_phids); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function addCCs(array $cc_phids) { | public function addCCs(array $cc_phids) { | ||||
$this->ccs = array_merge($this->ccs, $cc_phids); | $this->ccs = array_merge($this->ccs, $cc_phids); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setAttachInlineComments($attach_inline_comments) { | public function setAttachInlineComments($attach_inline_comments) { | ||||
$this->attachInlineComments = $attach_inline_comments; | $this->attachInlineComments = $attach_inline_comments; | ||||
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; | ||||
$actor = $this->getActor(); | $actor = $this->getActor(); | ||||
$other_comments = id(new PhabricatorAuditComment())->loadAllWhere( | $other_comments = id(new PhabricatorAuditComment())->loadAllWhere( | ||||
'targetPHID = %s', | 'targetPHID = %s', | ||||
$commit->getPHID()); | $commit->getPHID()); | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | public function addComment(PhabricatorAuditComment $comment) { | ||||
$feed_dont_publish_phids = array_keys($feed_dont_publish_phids); | $feed_dont_publish_phids = array_keys($feed_dont_publish_phids); | ||||
$feed_phids = array_diff($requests_phids, $feed_dont_publish_phids); | $feed_phids = array_diff($requests_phids, $feed_dont_publish_phids); | ||||
$this->publishFeedStory($comment, $feed_phids); | $this->publishFeedStory($comment, $feed_phids); | ||||
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); | ||||
} | } | ||||
} | |||||
/** | /** | ||||
* Load the PHIDs for all objects the user has the authority to act as an | * Load the PHIDs for all objects the user has the authority to act as an | ||||
* audit for. This includes themselves, and any packages they are an owner | * audit for. This includes themselves, and any packages they are an owner | ||||
* of. | * of. | ||||
*/ | */ | ||||
public static function loadAuditPHIDsForUser(PhabricatorUser $user) { | public static function loadAuditPHIDsForUser(PhabricatorUser $user) { | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |