mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-29 17:00:59 +01:00
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
This commit is contained in:
parent
ec3f3458e4
commit
2b4f96430b
1 changed files with 20 additions and 7 deletions
|
@ -77,6 +77,15 @@ final class PhabricatorCalendarEventEditController
|
|||
}
|
||||
|
||||
$errors = array();
|
||||
$name = $event->getName();
|
||||
$description = $event->getDescription();
|
||||
$type = $event->getStatus();
|
||||
|
||||
$current_policies = id(new PhabricatorPolicyQuery())
|
||||
->setViewer($user)
|
||||
->setObject($event)
|
||||
->execute();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$xactions = array();
|
||||
$name = $request->getStr('name');
|
||||
|
@ -85,6 +94,8 @@ final class PhabricatorCalendarEventEditController
|
|||
$end_value = $end_time->readValueFromRequest($request);
|
||||
$description = $request->getStr('description');
|
||||
$subscribers = $request->getArr('subscribers');
|
||||
$edit_policy = $request->getStr('editPolicy');
|
||||
$view_policy = $request->getStr('viewPolicy');
|
||||
|
||||
$invitees = $request->getArr('invitees');
|
||||
$new_invitees = $this->getNewInviteeList($invitees, $event);
|
||||
|
@ -159,7 +170,13 @@ final class PhabricatorCalendarEventEditController
|
|||
$validation_exception = $ex;
|
||||
$error_name = $ex
|
||||
->getShortMessage(PhabricatorCalendarEventTransaction::TYPE_NAME);
|
||||
|
||||
$event->setViewPolicy($view_policy);
|
||||
$event->setEditPolicy($edit_policy);
|
||||
}
|
||||
} else {
|
||||
$event->setViewPolicy($view_policy);
|
||||
$event->setEditPolicy($edit_policy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,24 +190,20 @@ final class PhabricatorCalendarEventEditController
|
|||
$name = id(new AphrontFormTextControl())
|
||||
->setLabel(pht('Name'))
|
||||
->setName('name')
|
||||
->setValue($event->getName())
|
||||
->setValue($name)
|
||||
->setError($error_name);
|
||||
|
||||
$status_select = id(new AphrontFormSelectControl())
|
||||
->setLabel(pht('Status'))
|
||||
->setName('status')
|
||||
->setValue($event->getStatus())
|
||||
->setValue($type)
|
||||
->setOptions($event->getStatusOptions());
|
||||
|
||||
$description = id(new AphrontFormTextAreaControl())
|
||||
->setLabel(pht('Description'))
|
||||
->setName('description')
|
||||
->setValue($event->getDescription());
|
||||
->setValue($description);
|
||||
|
||||
$current_policies = id(new PhabricatorPolicyQuery())
|
||||
->setViewer($user)
|
||||
->setObject($event)
|
||||
->execute();
|
||||
$view_policies = id(new AphrontFormPolicyControl())
|
||||
->setUser($user)
|
||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
|
||||
|
|
Loading…
Reference in a new issue