@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix some EditEngine issues with rendering "invite" transactions

Summary:
Ref T9275. We were rendering too many transactions and/or over-rendering invitees.

Clean this logic up a bit:

- List all before/after invitees.
- Simplify the lists before rendering.

Test Plan: Viewed an event, edited invitees, got sensible human-readable transactions.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9275

Differential Revision: https://secure.phabricator.com/D16284

+26 -6
+2
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 163 163 $map[$phid] = $status_uninvited; 164 164 } else if (!$is_old && $is_new) { 165 165 $map[$phid] = $status_invited; 166 + } else { 167 + $map[$phid] = $invitees[$phid]->getStatus(); 166 168 } 167 169 } 168 170
+24 -6
src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
··· 176 176 case self::TYPE_INVITE: 177 177 $text = null; 178 178 179 - // Fill in any new invitees as "uninvited" in the old data, to make 180 - // some of the rendering logic a little easier. 181 - $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; 182 - $old = $old + array_fill_keys(array_keys($new), $status_uninvited); 179 + list($old, $new) = $this->getSimpleInvites($old, $new); 183 180 184 181 if (count($old) === 1 185 182 && count($new) === 1 ··· 396 393 case self::TYPE_INVITE: 397 394 $text = null; 398 395 399 - $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; 400 - $old = $old + array_fill_keys(array_keys($new), $status_uninvited); 396 + list($old, $new) = $this->getSimpleInvites($old, $new); 401 397 402 398 if (count($old) === 1 403 399 && count($new) === 1 ··· 591 587 } 592 588 return $tags; 593 589 } 590 + 591 + private function getSimpleInvites(array $old, array $new) { 592 + // Fill in any new invitees as "uninvited" in the old data, to make 593 + // some of the rendering logic a little easier. 594 + $status_uninvited = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; 595 + $old = $old + array_fill_keys(array_keys($new), $status_uninvited); 596 + 597 + $all = $old + $new; 598 + foreach (array_keys($all) as $key) { 599 + // If the invitee exists in both the old and new lists with the same 600 + // value, remove it from both. 601 + if (isset($old[$key]) && isset($new[$key])) { 602 + if ($old[$key] == $new[$key]) { 603 + unset($old[$key]); 604 + unset($new[$key]); 605 + } 606 + } 607 + } 608 + 609 + return array($old, $new); 610 + } 611 + 594 612 595 613 }