Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15498613
D10927.id26247.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10927.id26247.diff
View Options
diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -203,6 +203,36 @@
case ConpherenceTransactionType::TYPE_TITLE:
$object->setTitle($xaction->getNewValue());
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);
}
@@ -259,22 +289,28 @@
$add = array_keys(array_diff_key($new_map, $old_map));
foreach ($add as $phid) {
- if ($phid == $this->getActor()->getPHID()) {
- $status = ConpherenceParticipationStatus::UP_TO_DATE;
- $message_count = $object->getMessageCount();
+ if ($this->getIsNewObject()) {
+ $participants[$phid]
+ ->setBehindTransactionPHID($xaction->getPHID())
+ ->save();
} else {
- $status = ConpherenceParticipationStatus::BEHIND;
- $message_count = 0;
+ if ($phid == $this->getActor()->getPHID()) {
+ $status = ConpherenceParticipationStatus::UP_TO_DATE;
+ $message_count = $object->getMessageCount();
+ } else {
+ $status = ConpherenceParticipationStatus::BEHIND;
+ $message_count = 0;
+ }
+ $participants[$phid] =
+ id(new ConpherenceParticipant())
+ ->setConpherencePHID($object->getPHID())
+ ->setParticipantPHID($phid)
+ ->setParticipationStatus($status)
+ ->setDateTouched(time())
+ ->setBehindTransactionPHID($xaction->getPHID())
+ ->setSeenMessageCount($message_count)
+ ->save();
}
- $participants[$phid] =
- id(new ConpherenceParticipant())
- ->setConpherencePHID($object->getPHID())
- ->setParticipantPHID($phid)
- ->setParticipationStatus($status)
- ->setDateTouched(time())
- ->setBehindTransactionPHID($xaction->getPHID())
- ->setSeenMessageCount($message_count)
- ->save();
}
$object->attachParticipants($participants);
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 14, 1:33 PM (2 w, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7465311
Default Alt Text
D10927.id26247.diff (3 KB)
Attached To
Mode
D10927: Conpherence - fix permissions issue creating new Conpherences
Attached
Detach File
Event Timeline
Log In to Comment