1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Improving UX for ignoring timezone conflicts

Summary:
When there is a new timezone conflict, you will be able to ignore it with a checkbox.
Fix T15349

Preview:

{F343198}

Test Plan: Having a conflicting timezone, click the notification so the usual popup appears. There is a checkbox, leave it checked to ignore the current conflict, uncheck to manually resolve the conflict by selecting one of the available timezones.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

Subscribers: speck, waldyrious, avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15349

Differential Revision: https://we.phorge.it/D25420
This commit is contained in:
roberto.urbani 2023-11-06 08:26:37 +00:00
parent 887e344c19
commit 37ecdf2336

View file

@ -31,11 +31,12 @@ final class PhabricatorSettingsTimezoneController
$did_calibrate = false;
if ($request->isFormPost()) {
$timezone = $request->getStr('timezone');
$ignore_conflict_checkbox = $request->getInt('ignoreConflict');
$pref_ignore = PhabricatorTimezoneIgnoreOffsetSetting::SETTINGKEY;
$pref_timezone = PhabricatorTimezoneSetting::SETTINGKEY;
if ($timezone == 'ignore') {
if ($timezone === 'ignore' || $ignore_conflict_checkbox) {
$this->writeSettings(
array(
$pref_ignore => $client_offset,
@ -83,20 +84,29 @@ final class PhabricatorSettingsTimezoneController
$guess = 'ignore';
}
$current_zone = $viewer->getTimezoneIdentifier();
$current_zone = phutil_tag('strong', array(), $current_zone);
$current_zone_identifier = $viewer->getTimezoneIdentifier();
$current_zone_formatted = phutil_tag(
'strong',
array(),
$current_zone_identifier);
$form = id(new AphrontFormView())
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Current Setting'))
->setValue($current_zone))
->setValue($current_zone_formatted))
->appendChild(
id(new AphrontFormSelectControl())
->setName('timezone')
->setLabel(pht('New Setting'))
->setOptions($options)
->setValue($guess));
->setValue($guess))
->appendChild(id(new AphrontFormCheckboxControl())
->addCheckbox(
'ignoreConflict',
1,
pht('Ignore New Setting and Keep %s', $current_zone_identifier)));
return $this->newDialog()
->setTitle(pht('Adjust Timezone'))
@ -110,7 +120,7 @@ final class PhabricatorSettingsTimezoneController
$this->formatOffset($server_offset)))
->appendForm($form)
->addCancelButton(pht('Cancel'))
->addSubmitButton(pht('Change Timezone'));
->addSubmitButton(pht('Confirm'));
}
private function formatOffset($offset) {