Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13980434
D16955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16955.diff
View Options
diff --git a/src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php
--- a/src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php
+++ b/src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php
@@ -22,6 +22,35 @@
->toDictionary();
}
+ public function getTransactionHasEffect($object, $old, $new) {
+ $editor = $this->getEditor();
+
+ $actor = $this->getActor();
+ $actor_timezone = $actor->getTimezoneIdentifier();
+
+ // When an edit only changes the timezone of an event without materially
+ // changing the absolute time, discard it. This can happen if two users in
+ // different timezones edit an event without rescheduling it.
+
+ // Eventually, after T11073, there may be a UI control to adjust timezones.
+ // If a user explicitly changed the timezone, we should respect that.
+ // However, there is no way for users to intentionally apply this kind of
+ // edit today.
+
+ $old_datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($old)
+ ->setIsAllDay($editor->getNewIsAllDay())
+ ->setViewerTimezone($actor_timezone);
+
+ $new_datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($new)
+ ->setIsAllDay($editor->getNewIsAllDay())
+ ->setViewerTimezone($actor_timezone);
+
+ $old_epoch = $old_datetime->getEpoch();
+ $new_epoch = $new_datetime->getEpoch();
+
+ return ($old_epoch !== $new_epoch);
+ }
+
public function validateTransactions($object, array $xactions) {
$errors = array();
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -502,6 +502,15 @@
return false;
}
+ $type = $xaction->getTransactionType();
+ $xtype = $this->getModularTransactionType($type);
+ if ($xtype) {
+ return $xtype->getTransactionHasEffect(
+ $object,
+ $xaction->getOldValue(),
+ $xaction->getNewValue());
+ }
+
return ($xaction->getOldValue() !== $xaction->getNewValue());
}
diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
--- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
@@ -35,6 +35,10 @@
return;
}
+ public function getTransactionHasEffect($object, $old, $new) {
+ return ($old !== $new);
+ }
+
public function extractFilePHIDs($object, $value) {
return array();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 20, 10:38 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736148
Default Alt Text
D16955.diff (2 KB)
Attached To
Mode
D16955: Ignore Calendar date edits which just change the internal date timezone without rescheduling it
Attached
Detach File
Event Timeline
Log In to Comment