@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 event update form submission should not lose date (except selected dates) when form has error.

Summary: Closes T8019, Calendar event update form submission should not lose date (except selected dates) when form has error.

Test Plan: Edit event, update date to invalid date, edit description, save, form should return an error and preserve the new description.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8019

Differential Revision: https://secure.phabricator.com/D12643

+20 -7
+20 -7
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 77 77 } 78 78 79 79 $errors = array(); 80 + $name = $event->getName(); 81 + $description = $event->getDescription(); 82 + $type = $event->getStatus(); 83 + 84 + $current_policies = id(new PhabricatorPolicyQuery()) 85 + ->setViewer($user) 86 + ->setObject($event) 87 + ->execute(); 88 + 80 89 if ($request->isFormPost()) { 81 90 $xactions = array(); 82 91 $name = $request->getStr('name'); ··· 85 94 $end_value = $end_time->readValueFromRequest($request); 86 95 $description = $request->getStr('description'); 87 96 $subscribers = $request->getArr('subscribers'); 97 + $edit_policy = $request->getStr('editPolicy'); 98 + $view_policy = $request->getStr('viewPolicy'); 88 99 89 100 $invitees = $request->getArr('invitees'); 90 101 $new_invitees = $this->getNewInviteeList($invitees, $event); ··· 159 170 $validation_exception = $ex; 160 171 $error_name = $ex 161 172 ->getShortMessage(PhabricatorCalendarEventTransaction::TYPE_NAME); 173 + 174 + $event->setViewPolicy($view_policy); 175 + $event->setEditPolicy($edit_policy); 162 176 } 177 + } else { 178 + $event->setViewPolicy($view_policy); 179 + $event->setEditPolicy($edit_policy); 163 180 } 164 181 } 165 182 ··· 173 190 $name = id(new AphrontFormTextControl()) 174 191 ->setLabel(pht('Name')) 175 192 ->setName('name') 176 - ->setValue($event->getName()) 193 + ->setValue($name) 177 194 ->setError($error_name); 178 195 179 196 $status_select = id(new AphrontFormSelectControl()) 180 197 ->setLabel(pht('Status')) 181 198 ->setName('status') 182 - ->setValue($event->getStatus()) 199 + ->setValue($type) 183 200 ->setOptions($event->getStatusOptions()); 184 201 185 202 $description = id(new AphrontFormTextAreaControl()) 186 203 ->setLabel(pht('Description')) 187 204 ->setName('description') 188 - ->setValue($event->getDescription()); 205 + ->setValue($description); 189 206 190 - $current_policies = id(new PhabricatorPolicyQuery()) 191 - ->setViewer($user) 192 - ->setObject($event) 193 - ->execute(); 194 207 $view_policies = id(new AphrontFormPolicyControl()) 195 208 ->setUser($user) 196 209 ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)