1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix "Author's projects" Herald rules for revisions and diffs

Summary:
See PHI71. These didn't get properly updated when we wrote Subprojects and Milestones, and should use materialized members, not raw members. Swap the query so projects you are an indirect member of (e.g., milestones you are a member of the parent for, and parent projects you are a member of a subproject of) are included in the result list.

Also fix a bad typeahead datasource.

Test Plan:
  - Ran a dry run with the test console, saw project PHIDs for milestones and parent projects in the raw field value.
  - Tried to set "Author's projects" to a user, no longer could.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18619
This commit is contained in:
epriestley 2017-09-15 17:46:15 -07:00
parent b352cacdd9
commit 51b810b0eb
2 changed files with 17 additions and 7 deletions

View file

@ -10,9 +10,14 @@ final class DifferentialDiffAuthorProjectsHeraldField
}
public function getHeraldFieldValue($object) {
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$object->getAuthorPHID(),
PhabricatorProjectMemberOfProjectEdgeType::EDGECONST);
$viewer = PhabricatorUser::getOmnipotentUser();
$projects = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withMemberPHIDs(array($object->getAuthorPHID()))
->execute();
return mpull($projects, 'getPHID');
}
protected function getHeraldFieldStandardType() {
@ -20,7 +25,7 @@ final class DifferentialDiffAuthorProjectsHeraldField
}
protected function getDatasource() {
return new PhabricatorProjectOrUserDatasource();
return new PhabricatorProjectDatasource();
}
}

View file

@ -10,9 +10,14 @@ final class DifferentialRevisionAuthorProjectsHeraldField
}
public function getHeraldFieldValue($object) {
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$object->getAuthorPHID(),
PhabricatorProjectMemberOfProjectEdgeType::EDGECONST);
$viewer = PhabricatorUser::getOmnipotentUser();
$projects = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withMemberPHIDs(array($object->getAuthorPHID()))
->execute();
return mpull($projects, 'getPHID');
}
protected function getHeraldFieldStandardType() {