@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.

Ignore Calendar date edits which just change the internal date timezone without rescheduling it

Summary:
Ref T11816. Currently, if someone in California creates an event and then someone in New York edits it, we generate a no-op "<user> changed the start time from 3PM to 3PM." transaction.

This is because the internal timezone of the event is changing, but the actual absolute time is not.

Instead, when an edit wouldn't reschedule an event and would only change the internal timezone, ignore the edit.

Test Plan:
- Edited non-all-day events in PST / EST with out making changes (ignored).
- Edited non-all-day events in PST / EST with changes (changes worked).
- Performed the same edits with all-day events, which also were ignored and worked, respectively.
- Pulled events in and out of all-day mode in different timezones, behavior seemeed reasonable.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11816

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

+42
+29
src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php
··· 22 22 ->toDictionary(); 23 23 } 24 24 25 + public function getTransactionHasEffect($object, $old, $new) { 26 + $editor = $this->getEditor(); 27 + 28 + $actor = $this->getActor(); 29 + $actor_timezone = $actor->getTimezoneIdentifier(); 30 + 31 + // When an edit only changes the timezone of an event without materially 32 + // changing the absolute time, discard it. This can happen if two users in 33 + // different timezones edit an event without rescheduling it. 34 + 35 + // Eventually, after T11073, there may be a UI control to adjust timezones. 36 + // If a user explicitly changed the timezone, we should respect that. 37 + // However, there is no way for users to intentionally apply this kind of 38 + // edit today. 39 + 40 + $old_datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($old) 41 + ->setIsAllDay($editor->getNewIsAllDay()) 42 + ->setViewerTimezone($actor_timezone); 43 + 44 + $new_datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($new) 45 + ->setIsAllDay($editor->getNewIsAllDay()) 46 + ->setViewerTimezone($actor_timezone); 47 + 48 + $old_epoch = $old_datetime->getEpoch(); 49 + $new_epoch = $new_datetime->getEpoch(); 50 + 51 + return ($old_epoch !== $new_epoch); 52 + } 53 + 25 54 public function validateTransactions($object, array $xactions) { 26 55 $errors = array(); 27 56
+9
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 502 502 return false; 503 503 } 504 504 505 + $type = $xaction->getTransactionType(); 506 + $xtype = $this->getModularTransactionType($type); 507 + if ($xtype) { 508 + return $xtype->getTransactionHasEffect( 509 + $object, 510 + $xaction->getOldValue(), 511 + $xaction->getNewValue()); 512 + } 513 + 505 514 return ($xaction->getOldValue() !== $xaction->getNewValue()); 506 515 } 507 516
+4
src/applications/transactions/storage/PhabricatorModularTransactionType.php
··· 35 35 return; 36 36 } 37 37 38 + public function getTransactionHasEffect($object, $old, $new) { 39 + return ($old !== $new); 40 + } 41 + 38 42 public function extractFilePHIDs($object, $value) { 39 43 return array(); 40 44 }