mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-04 11:51:02 +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:
parent
f3a4d27cfe
commit
64e4b3aef4
6 changed files with 17 additions and 15 deletions
|
@ -83,7 +83,12 @@ final class DiffusionDoorkeeperCommitFeedStoryPublisher
|
||||||
$request_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(
|
$request_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(
|
||||||
array($object->getID()));
|
array($object->getID()));
|
||||||
} else if ($object instanceof PhabricatorProject) {
|
} 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 {
|
} else {
|
||||||
// Dunno what this is.
|
// Dunno what this is.
|
||||||
$request_phids = array();
|
$request_phids = array();
|
||||||
|
|
|
@ -209,8 +209,12 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker {
|
||||||
// Add the silent followers first so that a user who is both a reviewer and
|
// 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.
|
// a CC gets silently added and then implicitly skipped by then noisy add.
|
||||||
// They will get a subtask notification.
|
// They will get a subtask notification.
|
||||||
|
|
||||||
|
// 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, $silent_followers, true);
|
||||||
$this->addFollowers($oauth_token, $task_id, $noisy_followers);
|
$this->addFollowers($oauth_token, $task_id, $noisy_followers);
|
||||||
|
}
|
||||||
|
|
||||||
$dst_phid = $parent_ref->getExternalObject()->getPHID();
|
$dst_phid = $parent_ref->getExternalObject()->getPHID();
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,8 @@ final class HeraldCommitAdapter extends HeraldAdapter {
|
||||||
|
|
||||||
$object = new HeraldCommitAdapter();
|
$object = new HeraldCommitAdapter();
|
||||||
|
|
||||||
|
$commit->attachRepository($repository);
|
||||||
|
|
||||||
$object->repository = $repository;
|
$object->repository = $repository;
|
||||||
$object->commit = $commit;
|
$object->commit = $commit;
|
||||||
$object->commitData = $commit_data;
|
$object->commitData = $commit_data;
|
||||||
|
|
|
@ -16,6 +16,7 @@ final class PhabricatorProjectMembersEditController
|
||||||
$project = id(new PhabricatorProjectQuery())
|
$project = id(new PhabricatorProjectQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($this->id))
|
||||||
|
->needMembers(true)
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
@ -30,7 +31,7 @@ final class PhabricatorProjectMembersEditController
|
||||||
$profile = new PhabricatorProjectProfile();
|
$profile = new PhabricatorProjectProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
$member_phids = $project->loadMemberPHIDs();
|
$member_phids = $project->getMemberPHIDs();
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
|
|
|
@ -213,8 +213,7 @@ final class PhabricatorProjectEditor extends PhabricatorEditor {
|
||||||
$xaction->setOldValue($project->getStatus());
|
$xaction->setOldValue($project->getStatus());
|
||||||
break;
|
break;
|
||||||
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
|
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
|
||||||
$member_phids = $project->loadMemberPHIDs();
|
$member_phids = $project->getMemberPHIDs();
|
||||||
$project->attachMemberPHIDs($member_phids);
|
|
||||||
|
|
||||||
$old_value = array_values($member_phids);
|
$old_value = array_values($member_phids);
|
||||||
$xaction->setOldValue($old_value);
|
$xaction->setOldValue($old_value);
|
||||||
|
|
|
@ -112,15 +112,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO
|
||||||
return $this->assertAttached($this->memberPHIDs);
|
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) {
|
public function setPhrictionSlug($slug) {
|
||||||
|
|
||||||
// NOTE: We're doing a little magic here and stripping out '/' so that
|
// NOTE: We're doing a little magic here and stripping out '/' so that
|
||||||
|
|
Loading…
Reference in a new issue