@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 two Calendar availability cache issues

Summary:
Fixes T12661.

When changing the start date of an event from some time in the past to some time significantly in the future (more than 24 hours), we'd invalidate only future caches and leave users in an "away" state. Instead, just invalidate all past and future caches (this is simpler than trying to figure out a narrower window, and should not make us do too much extra work).

When uninviting users from events, their caches also didn't get cleared correctly. Instead, clear them.

Test Plan:
- Changed an event from "Apr 1 - June 1" to "May 15 - June 1", saw availablity clear properly.
- Uninvited user `@dog` from an ongoing event, saw availability clear properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12661

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

+14 -7
+14 -7
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 127 127 // Clear the availability caches for users whose availability is affected 128 128 // by this edit. 129 129 130 + $phids = mpull($object->getInvitees(), 'getInviteePHID'); 131 + $phids = array_fuse($phids); 132 + 130 133 $invalidate_all = false; 131 134 $invalidate_phids = array(); 132 135 foreach ($xactions as $xaction) { ··· 146 149 $invalidate_phids[$acting_phid] = $acting_phid; 147 150 break; 148 151 case PhabricatorCalendarEventInviteTransaction::TRANSACTIONTYPE: 149 - foreach ($xaction->getNewValue() as $phid => $ignored) { 152 + foreach ($xaction->getOldValue() as $phid) { 153 + // Add the possibly un-invited user to the list of potentially 154 + // affected users if they are't already present. 155 + $phids[$phid] = $phid; 156 + 157 + $invalidate_phids[$phid] = $phid; 158 + } 159 + 160 + foreach ($xaction->getNewValue() as $phid) { 150 161 $invalidate_phids[$phid] = $phid; 151 162 } 152 163 break; 153 164 } 154 165 } 155 - 156 - $phids = mpull($object->getInvitees(), 'getInviteePHID'); 157 - $phids = array_fuse($phids); 158 166 159 167 if (!$invalidate_all) { 160 168 $phids = array_select_keys($phids, $invalidate_phids); ··· 168 176 queryfx( 169 177 $conn_w, 170 178 'UPDATE %T SET availabilityCacheTTL = NULL 171 - WHERE phid IN (%Ls) AND availabilityCacheTTL >= %d', 179 + WHERE phid IN (%Ls)', 172 180 $user->getTableName(), 173 - $phids, 174 - $object->getStartDateTimeEpochForCache()); 181 + $phids); 175 182 } 176 183 177 184 return $xactions;