1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 06:50:55 +01:00

Calendar - error better with invalid time values

Summary: Fixes T7665. Unfortunately when the user messes this up its not easy to partially recover so we just reset that time to the default.

Test Plan: set time to "00:00 AM" and got a sensible error.

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7665

Differential Revision: https://secure.phabricator.com/D12174
This commit is contained in:
Bob Trahan 2015-03-26 13:02:49 -07:00
parent 4ae28837fd
commit 871c06ab4e

View file

@ -66,16 +66,24 @@ final class PhabricatorCalendarEventEditController
$end_value = $end_time->readValueFromRequest($request); $end_value = $end_time->readValueFromRequest($request);
$description = $request->getStr('description'); $description = $request->getStr('description');
try { if ($start_time->getError()) {
$status $errors[] = pht('Invalid start time; reset to default.');
->setUserPHID($user->getPHID()) }
->setStatus($type) if ($end_time->getError()) {
->setDateFrom($start_value) $errors[] = pht('Invalid end time; reset to default.');
->setDateTo($end_value) }
->setDescription($description) if (!$errors) {
->save(); try {
} catch (PhabricatorCalendarEventInvalidEpochException $e) { $status
$errors[] = pht('Start must be before end.'); ->setUserPHID($user->getPHID())
->setStatus($type)
->setDateFrom($start_value)
->setDateTo($end_value)
->setDescription($description)
->save();
} catch (PhabricatorCalendarEventInvalidEpochException $e) {
$errors[] = pht('Start must be before end.');
}
} }
if (!$errors) { if (!$errors) {