1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

Don't allow "Start Time" / "End Time" in Calendar event forms to be locked or have defaults assigned

Summary: Fixes T11733. This fixes the issue by working around it, but it isn't useful to set these fields to a default value anyway.

Test Plan: Created a default Calendar form, set some other defaults, created an event, stuff no longer exploded.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11733

Differential Revision: https://secure.phabricator.com/D16753
This commit is contained in:
epriestley 2016-10-26 12:35:53 -07:00
parent 2d7f574b9d
commit 7cb44bcee6
2 changed files with 14 additions and 0 deletions

View file

@ -164,6 +164,8 @@ final class PhabricatorCalendarEventEditEngine
if ($this->getIsCreate() || $object->getIsRecurring()) {
$fields[] = id(new PhabricatorEpochEditField())
->setIsLockable(false)
->setIsDefaultable(false)
->setAllowNull(true)
->setKey('until')
->setLabel(pht('Repeat Until'))
@ -189,6 +191,8 @@ final class PhabricatorCalendarEventEditEngine
$fields[] = id(new PhabricatorEpochEditField())
->setKey('start')
->setLabel(pht('Start'))
->setIsLockable(false)
->setIsDefaultable(false)
->setTransactionType(
PhabricatorCalendarEventStartDateTransaction::TRANSACTIONTYPE)
->setDescription(pht('Start time of the event.'))
@ -199,6 +203,8 @@ final class PhabricatorCalendarEventEditEngine
$fields[] = id(new PhabricatorEpochEditField())
->setKey('end')
->setLabel(pht('End'))
->setIsLockable(false)
->setIsDefaultable(false)
->setTransactionType(
PhabricatorCalendarEventEndDateTransaction::TRANSACTIONTYPE)
->setDescription(pht('End time of the event.'))

View file

@ -128,6 +128,9 @@ final class PhabricatorEditEngineConfiguration
$values = $this->getProperty('defaults', array());
foreach ($fields as $key => $field) {
if (!$field->getIsDefaultable()) {
continue;
}
if ($is_new) {
if (array_key_exists($key, $values)) {
$field->readDefaultValueFromConfiguration($values[$key]);
@ -157,6 +160,11 @@ final class PhabricatorEditEngineConfiguration
}
}
// If the field isn't lockable, remove any lock we applied.
if (!$field->getIsLockable()) {
$field->setIsLocked(false);
}
$fields = $this->reorderFields($fields);
$preamble = $this->getPreamble();