Page MenuHomePhabricator

D16284.diff
No OneTemporary

D16284.diff

diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
@@ -163,6 +163,8 @@
$map[$phid] = $status_uninvited;
} else if (!$is_old && $is_new) {
$map[$phid] = $status_invited;
+ } else {
+ $map[$phid] = $invitees[$phid]->getStatus();
}
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
@@ -176,10 +176,7 @@
case self::TYPE_INVITE:
$text = null;
- // Fill in any new invitees as "uninvited" in the old data, to make
- // some of the rendering logic a little easier.
- $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
- $old = $old + array_fill_keys(array_keys($new), $status_uninvited);
+ list($old, $new) = $this->getSimpleInvites($old, $new);
if (count($old) === 1
&& count($new) === 1
@@ -396,8 +393,7 @@
case self::TYPE_INVITE:
$text = null;
- $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
- $old = $old + array_fill_keys(array_keys($new), $status_uninvited);
+ list($old, $new) = $this->getSimpleInvites($old, $new);
if (count($old) === 1
&& count($new) === 1
@@ -592,4 +588,26 @@
return $tags;
}
+ private function getSimpleInvites(array $old, array $new) {
+ // Fill in any new invitees as "uninvited" in the old data, to make
+ // some of the rendering logic a little easier.
+ $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED;
+ $old = $old + array_fill_keys(array_keys($new), $status_uninvited);
+
+ $all = $old + $new;
+ foreach (array_keys($all) as $key) {
+ // If the invitee exists in both the old and new lists with the same
+ // value, remove it from both.
+ if (isset($old[$key]) && isset($new[$key])) {
+ if ($old[$key] == $new[$key]) {
+ unset($old[$key]);
+ unset($new[$key]);
+ }
+ }
+ }
+
+ return array($old, $new);
+ }
+
+
}

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 4:21 AM (3 w, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288791
Default Alt Text
D16284.diff (2 KB)

Event Timeline