Skip to content

Commit 76863d7

Browse files
committed
Keep display timezone on drag & drop
1 parent d02f5b8 commit 76863d7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

application/controllers/ScheduleController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,13 @@ public function moveRotationAction(): void
219219
$form = new MoveRotationForm(Database::get());
220220
$form->on(MoveRotationForm::ON_SUCCESS, function (MoveRotationForm $form) {
221221
$this->sendExtraUpdates(['#col1']);
222-
$this->redirectNow(Links::schedule($form->getScheduleId()));
222+
$requestUrl = Url::fromRequest();
223+
$redirectUrl = Links::schedule($form->getScheduleId());
224+
$defaultTimezoneParam = TimezonePicker::DEFAULT_TIMEZONE_PARAM;
225+
if ($requestUrl->hasParam($defaultTimezoneParam)) {
226+
$redirectUrl->addParams([$defaultTimezoneParam => $requestUrl->getParam($defaultTimezoneParam)]);
227+
}
228+
$this->redirectNow($redirectUrl);
223229
});
224230

225231
$form->handleRequest($this->getServerRequest());

library/Notifications/Widget/Timeline.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ protected function assembleSidebarEntry(Rotation $rotation): BaseHtmlElement
307307
$entry = new HtmlElement('div', Attributes::create(['class' => 'rotation-name']));
308308

309309
$form = new MoveRotationForm();
310-
$form->setAction(Links::moveRotation()->getAbsoluteUrl());
310+
$form->setAction(
311+
Links::moveRotation()
312+
->with(['display_timezone' => ScheduleDateTimeFactory::getDisplayTimezone()->getName()])
313+
->getAbsoluteUrl()
314+
);
311315
$form->populate([
312316
'rotation' => $rotation->getId(),
313317
'priority' => $rotation->getPriority()

0 commit comments

Comments
 (0)