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

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

+18 -10
+18 -10
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 66 66 $end_value = $end_time->readValueFromRequest($request); 67 67 $description = $request->getStr('description'); 68 68 69 - try { 70 - $status 71 - ->setUserPHID($user->getPHID()) 72 - ->setStatus($type) 73 - ->setDateFrom($start_value) 74 - ->setDateTo($end_value) 75 - ->setDescription($description) 76 - ->save(); 77 - } catch (PhabricatorCalendarEventInvalidEpochException $e) { 78 - $errors[] = pht('Start must be before end.'); 69 + if ($start_time->getError()) { 70 + $errors[] = pht('Invalid start time; reset to default.'); 71 + } 72 + if ($end_time->getError()) { 73 + $errors[] = pht('Invalid end time; reset to default.'); 74 + } 75 + if (!$errors) { 76 + try { 77 + $status 78 + ->setUserPHID($user->getPHID()) 79 + ->setStatus($type) 80 + ->setDateFrom($start_value) 81 + ->setDateTo($end_value) 82 + ->setDescription($description) 83 + ->save(); 84 + } catch (PhabricatorCalendarEventInvalidEpochException $e) { 85 + $errors[] = pht('Start must be before end.'); 86 + } 79 87 } 80 88 81 89 if (!$errors) {