From 63fec9b97d6fd2e2dccbc9ef00e4be710d2e0e9d Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 12 Jul 2016 14:39:24 -0700 Subject: [PATCH] Restore date validation errors to Calendar Summary: Ref T9275. I waffled back and forth on these transactions a bit, but put these back here in better working order. Test Plan: Tried to schedule an event on "taco". Reviewers: chad Reviewed By: chad Maniphest Tasks: T9275 Differential Revision: https://secure.phabricator.com/D16285 --- .../editor/PhabricatorCalendarEventEditor.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index e12023db52..33cbdc46e6 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -465,6 +465,34 @@ final class PhabricatorCalendarEventEditor } } break; + case PhabricatorCalendarEventTransaction::TYPE_START_DATE: + case PhabricatorCalendarEventTransaction::TYPE_END_DATE: + case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE: + foreach ($xactions as $xaction) { + if ($xaction->getNewValue()->isValid()) { + continue; + } + + switch ($type) { + case PhabricatorCalendarEventTransaction::TYPE_START_DATE: + $message = pht('Start date is invalid.'); + break; + case PhabricatorCalendarEventTransaction::TYPE_END_DATE: + $message = pht('End date is invalid.'); + break; + case PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE: + $message = pht('Repeat until date is invalid.'); + break; + } + + $errors[] = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Invalid'), + $message, + $xaction); + } + break; + } return $errors;