mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Conpherence - fix permissions issue creating new Conpherences
Summary: Fixes T6690. The editor innards end up loading the conpherence object, whose policy is dictated by these participation objects. Test Plan: pre patch could not create new conpherences. post patch I can create conpherences! i can also add people to conpherences and it works. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6690 Differential Revision: https://secure.phabricator.com/D10927
This commit is contained in:
parent
f6e635c8d2
commit
49e53d5709
1 changed files with 50 additions and 14 deletions
|
@ -203,6 +203,36 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
case ConpherenceTransactionType::TYPE_TITLE:
|
case ConpherenceTransactionType::TYPE_TITLE:
|
||||||
$object->setTitle($xaction->getNewValue());
|
$object->setTitle($xaction->getNewValue());
|
||||||
break;
|
break;
|
||||||
|
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
|
||||||
|
// If this is a new ConpherenceThread, we have to create the
|
||||||
|
// participation data asap to pass policy checks. For existing
|
||||||
|
// ConpherenceThreads, the existing participation is correct
|
||||||
|
// at this stage. Note that later in applyCustomExternalTransaction
|
||||||
|
// this participation data will be updated, particularly the
|
||||||
|
// behindTransactionPHID which is just a generated dummy for now.
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
$participants = array();
|
||||||
|
foreach ($xaction->getNewValue() as $phid) {
|
||||||
|
if ($phid == $this->getActor()->getPHID()) {
|
||||||
|
$status = ConpherenceParticipationStatus::UP_TO_DATE;
|
||||||
|
$message_count = 1;
|
||||||
|
} else {
|
||||||
|
$status = ConpherenceParticipationStatus::BEHIND;
|
||||||
|
$message_count = 0;
|
||||||
|
}
|
||||||
|
$participants[$phid] =
|
||||||
|
id(new ConpherenceParticipant())
|
||||||
|
->setConpherencePHID($object->getPHID())
|
||||||
|
->setParticipantPHID($phid)
|
||||||
|
->setParticipationStatus($status)
|
||||||
|
->setDateTouched(time())
|
||||||
|
->setBehindTransactionPHID($xaction->generatePHID())
|
||||||
|
->setSeenMessageCount($message_count)
|
||||||
|
->save();
|
||||||
|
$object->attachParticipants($participants);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$this->updateRecentParticipantPHIDs($object, $xaction);
|
$this->updateRecentParticipantPHIDs($object, $xaction);
|
||||||
}
|
}
|
||||||
|
@ -259,6 +289,11 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
|
|
||||||
$add = array_keys(array_diff_key($new_map, $old_map));
|
$add = array_keys(array_diff_key($new_map, $old_map));
|
||||||
foreach ($add as $phid) {
|
foreach ($add as $phid) {
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
$participants[$phid]
|
||||||
|
->setBehindTransactionPHID($xaction->getPHID())
|
||||||
|
->save();
|
||||||
|
} else {
|
||||||
if ($phid == $this->getActor()->getPHID()) {
|
if ($phid == $this->getActor()->getPHID()) {
|
||||||
$status = ConpherenceParticipationStatus::UP_TO_DATE;
|
$status = ConpherenceParticipationStatus::UP_TO_DATE;
|
||||||
$message_count = $object->getMessageCount();
|
$message_count = $object->getMessageCount();
|
||||||
|
@ -276,6 +311,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
->setSeenMessageCount($message_count)
|
->setSeenMessageCount($message_count)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$object->attachParticipants($participants);
|
$object->attachParticipants($participants);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue