From 57e22e3ce591d37170a9f8a58ee6d871b30a5353 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 7 May 2015 16:57:49 -0700 Subject: [PATCH] Just a sql patch for all day events. Summary: Ref T8021, sql patch for all day events. Test Plan: check schema by running `bin/storage upgrade` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8021 Differential Revision: https://secure.phabricator.com/D12763 --- .../sql/autopatches/20150507.calendar.1.isallday.sql | 2 ++ .../calendar/editor/PhabricatorCalendarEventEditor.php | 8 ++++++++ .../calendar/storage/PhabricatorCalendarEvent.php | 2 ++ .../storage/PhabricatorCalendarEventTransaction.php | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 resources/sql/autopatches/20150507.calendar.1.isallday.sql diff --git a/resources/sql/autopatches/20150507.calendar.1.isallday.sql b/resources/sql/autopatches/20150507.calendar.1.isallday.sql new file mode 100644 index 0000000000..172015b1be --- /dev/null +++ b/resources/sql/autopatches/20150507.calendar.1.isallday.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + ADD isAllDay BOOL NOT NULL; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 09ab1309eb..f00ba4349f 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -21,6 +21,7 @@ final class PhabricatorCalendarEventEditor $types[] = PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION; $types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL; $types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE; + $types[] = PhabricatorCalendarEventTransaction::TYPE_ALL_DAY; $types[] = PhabricatorTransactions::TYPE_COMMENT; $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; @@ -49,6 +50,8 @@ final class PhabricatorCalendarEventEditor return $object->getDescription(); case PhabricatorCalendarEventTransaction::TYPE_CANCEL: return $object->getIsCancelled(); + case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: + return $object->getIsAllDay(); case PhabricatorCalendarEventTransaction::TYPE_INVITE: $map = $xaction->getNewValue(); $phids = array_keys($map); @@ -86,6 +89,7 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: case PhabricatorCalendarEventTransaction::TYPE_INVITE: + case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: return $xaction->getNewValue(); case PhabricatorCalendarEventTransaction::TYPE_STATUS: return (int)$xaction->getNewValue(); @@ -120,6 +124,9 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_CANCEL: $object->setIsCancelled((int)$xaction->getNewValue()); return; + case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: + $object->setIsAllDay((int)$xaction->getNewValue()); + return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: @@ -143,6 +150,7 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_STATUS: case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: + case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: $map = $xaction->getNewValue(); diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 03da6851a5..a63c869808 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -17,6 +17,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO protected $status; protected $description; protected $isCancelled; + protected $isAllDay; protected $mailKey; protected $viewPolicy; @@ -84,6 +85,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO 'status' => 'uint32', 'description' => 'text', 'isCancelled' => 'bool', + 'isAllDay' => 'bool', 'mailKey' => 'bytes20', ), self::CONFIG_KEY_SCHEMA => array( diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php index 7e4e7ff512..ef61e5b1e8 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php @@ -9,6 +9,7 @@ final class PhabricatorCalendarEventTransaction const TYPE_STATUS = 'calendar.status'; const TYPE_DESCRIPTION = 'calendar.description'; const TYPE_CANCEL = 'calendar.cancel'; + const TYPE_ALL_DAY = 'calendar.allday'; const TYPE_INVITE = 'calendar.invite'; const MAILTAG_RESCHEDULE = 'calendar-reschedule'; @@ -37,6 +38,7 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_CANCEL: + case self::TYPE_ALL_DAY: $phids[] = $this->getObjectPHID(); break; case self::TYPE_INVITE: @@ -58,6 +60,7 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_CANCEL: + case self::TYPE_ALL_DAY: case self::TYPE_INVITE: return ($old === null); } @@ -71,6 +74,7 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_END_DATE: case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: + case self::TYPE_ALL_DAY: case self::TYPE_CANCEL: return 'fa-pencil'; break;