mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Make sure auditors are attached to commits on new pathways
Companion change to D19022 for commits. Mentioning and subscribing to commits can load them without audit data.
This commit is contained in:
parent
9b7d5b74d4
commit
c64aae052f
2 changed files with 28 additions and 0 deletions
|
@ -490,6 +490,8 @@ final class PhabricatorAuditEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
|
$this->requireAuditors($object);
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
|
|
||||||
if ($object->getAuthorPHID()) {
|
if ($object->getAuthorPHID()) {
|
||||||
|
@ -514,6 +516,8 @@ final class PhabricatorAuditEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
|
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
|
||||||
|
$this->requireAuditors($object);
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
|
|
||||||
foreach ($object->getAudits() as $auditor) {
|
foreach ($object->getAudits() as $auditor) {
|
||||||
|
@ -856,4 +860,24 @@ final class PhabricatorAuditEditor
|
||||||
->executeOne();
|
->executeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function requireAuditors(PhabricatorRepositoryCommit $commit) {
|
||||||
|
if ($commit->hasAttachedAudits()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$with_auditors = id(new DiffusionCommitQuery())
|
||||||
|
->setViewer($this->getActor())
|
||||||
|
->needAuditRequests(true)
|
||||||
|
->withPHIDs(array($commit->getPHID()))
|
||||||
|
->executeOne();
|
||||||
|
if (!$with_auditors) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Failed to reload commit ("%s").',
|
||||||
|
$commit->getPHID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
$commit->attachAudits($with_auditors->getAudits());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,10 @@ final class PhabricatorRepositoryCommit
|
||||||
return $this->assertAttached($this->audits);
|
return $this->assertAttached($this->audits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasAttachedAudits() {
|
||||||
|
return ($this->audits !== self::ATTACHABLE);
|
||||||
|
}
|
||||||
|
|
||||||
public function loadAndAttachAuditAuthority(
|
public function loadAndAttachAuditAuthority(
|
||||||
PhabricatorUser $viewer,
|
PhabricatorUser $viewer,
|
||||||
$actor_phid = null) {
|
$actor_phid = null) {
|
||||||
|
|
Loading…
Reference in a new issue