mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Conpherence - fix conpherence create
Summary: somewhere along the line this broke. Before this patch we fail the visibility check since its based on Conpherence Participants which don't get created and attached until applyExternalEffects. Believe it or not, this was the least gross fix I could come up with; since the permission check is done SO early most other ideas I had involved creating a dummy participant object to pass the check then handling things for real later on... Ref T3723. Test Plan: created a conpherence with myself - great success Reviewers: epriestley Reviewed By: epriestley CC: chad, Korvin, aran Maniphest Tasks: T3723 Differential Revision: https://secure.phabricator.com/D6762
This commit is contained in:
parent
23e68ee8cb
commit
3d8eb641ea
2 changed files with 22 additions and 3 deletions
|
@ -45,8 +45,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
|||
}
|
||||
|
||||
if (!$errors) {
|
||||
$conpherence->openTransaction();
|
||||
$conpherence->save();
|
||||
$xactions = array();
|
||||
$xactions[] = id(new ConpherenceTransaction())
|
||||
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
|
||||
|
@ -74,7 +72,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
|||
->setActor($creator)
|
||||
->applyTransactions($conpherence, $xactions);
|
||||
|
||||
$conpherence->saveTransaction();
|
||||
}
|
||||
|
||||
return array($errors, $conpherence);
|
||||
|
@ -172,6 +169,24 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
|||
return $lock;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to apply initial effects IFF the conpherence is new. We must
|
||||
* save the conpherence first thing to make sure we have an id and a phid.
|
||||
*/
|
||||
protected function shouldApplyInitialEffects(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
return !$object->getID();
|
||||
}
|
||||
|
||||
protected function applyInitialEffects(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
$object->save();
|
||||
}
|
||||
|
||||
protected function applyCustomInternalTransaction(
|
||||
PhabricatorLiskDAO $object,
|
||||
PhabricatorApplicationTransaction $xaction) {
|
||||
|
|
|
@ -213,6 +213,10 @@ final class ConpherenceThread extends ConpherenceDAO
|
|||
}
|
||||
|
||||
public function hasAutomaticCapability($capability, PhabricatorUser $user) {
|
||||
// this bad boy isn't even created yet so go nuts $user
|
||||
if (!$this->getID()) {
|
||||
return true;
|
||||
}
|
||||
$participants = $this->getParticipants();
|
||||
return isset($participants[$user->getPHID()]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue