1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Remove loadMemberPHIDs from PhabricatorProject

Summary:
Ref T603. Move toward stamping out all the Project / ProjectProfile query irregularities with respect to policies.

  - Fixes a bug with Asana publishing when the remote task is deleted.
  - Fixes an issue with Herald commit rules.

Test Plan:
  - Viewed projects;
  - edited projects;
  - added and removed members from projects;
  - republished Asana-bridged feed stories about commits.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7251
This commit is contained in:
epriestley 2013-10-06 17:07:08 -07:00
parent f3a4d27cfe
commit 64e4b3aef4
6 changed files with 17 additions and 15 deletions

View file

@ -83,7 +83,12 @@ final class DiffusionDoorkeeperCommitFeedStoryPublisher
$request_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(
array($object->getID()));
} else if ($object instanceof PhabricatorProject) {
$request_phids = $object->loadMemberPHIDs();
$project = id(new PhabricatorProjectQuery())
->setViewer($this->getViewer())
->withIDs(array($object->getID()))
->needMembers(true)
->executeOne();
$request_phids = $project->getMemberPHIDs();
} else {
// Dunno what this is.
$request_phids = array();

View file

@ -209,8 +209,12 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker {
// Add the silent followers first so that a user who is both a reviewer and
// a CC gets silently added and then implicitly skipped by then noisy add.
// They will get a subtask notification.
$this->addFollowers($oauth_token, $task_id, $silent_followers, true);
$this->addFollowers($oauth_token, $task_id, $noisy_followers);
// We only do this if the task still exists.
if (empty($extra_data['gone'])) {
$this->addFollowers($oauth_token, $task_id, $silent_followers, true);
$this->addFollowers($oauth_token, $task_id, $noisy_followers);
}
$dst_phid = $parent_ref->getExternalObject()->getPHID();

View file

@ -150,6 +150,8 @@ final class HeraldCommitAdapter extends HeraldAdapter {
$object = new HeraldCommitAdapter();
$commit->attachRepository($repository);
$object->repository = $repository;
$object->commit = $commit;
$object->commitData = $commit_data;

View file

@ -16,6 +16,7 @@ final class PhabricatorProjectMembersEditController
$project = id(new PhabricatorProjectQuery())
->setViewer($user)
->withIDs(array($this->id))
->needMembers(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@ -30,7 +31,7 @@ final class PhabricatorProjectMembersEditController
$profile = new PhabricatorProjectProfile();
}
$member_phids = $project->loadMemberPHIDs();
$member_phids = $project->getMemberPHIDs();
$errors = array();
if ($request->isFormPost()) {

View file

@ -213,8 +213,7 @@ final class PhabricatorProjectEditor extends PhabricatorEditor {
$xaction->setOldValue($project->getStatus());
break;
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
$member_phids = $project->loadMemberPHIDs();
$project->attachMemberPHIDs($member_phids);
$member_phids = $project->getMemberPHIDs();
$old_value = array_values($member_phids);
$xaction->setOldValue($old_value);

View file

@ -112,15 +112,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO
return $this->assertAttached($this->memberPHIDs);
}
public function loadMemberPHIDs() {
if (!$this->getPHID()) {
return array();
}
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->getPHID(),
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER);
}
public function setPhrictionSlug($slug) {
// NOTE: We're doing a little magic here and stripping out '/' so that