mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +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:
parent
887e344c19
commit
37ecdf2336
1 changed files with 16 additions and 6 deletions
|
@ -31,11 +31,12 @@ final class PhabricatorSettingsTimezoneController
|
||||||
$did_calibrate = false;
|
$did_calibrate = false;
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
$timezone = $request->getStr('timezone');
|
$timezone = $request->getStr('timezone');
|
||||||
|
$ignore_conflict_checkbox = $request->getInt('ignoreConflict');
|
||||||
|
|
||||||
$pref_ignore = PhabricatorTimezoneIgnoreOffsetSetting::SETTINGKEY;
|
$pref_ignore = PhabricatorTimezoneIgnoreOffsetSetting::SETTINGKEY;
|
||||||
$pref_timezone = PhabricatorTimezoneSetting::SETTINGKEY;
|
$pref_timezone = PhabricatorTimezoneSetting::SETTINGKEY;
|
||||||
|
|
||||||
if ($timezone == 'ignore') {
|
if ($timezone === 'ignore' || $ignore_conflict_checkbox) {
|
||||||
$this->writeSettings(
|
$this->writeSettings(
|
||||||
array(
|
array(
|
||||||
$pref_ignore => $client_offset,
|
$pref_ignore => $client_offset,
|
||||||
|
@ -83,20 +84,29 @@ final class PhabricatorSettingsTimezoneController
|
||||||
$guess = 'ignore';
|
$guess = 'ignore';
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_zone = $viewer->getTimezoneIdentifier();
|
$current_zone_identifier = $viewer->getTimezoneIdentifier();
|
||||||
$current_zone = phutil_tag('strong', array(), $current_zone);
|
$current_zone_formatted = phutil_tag(
|
||||||
|
'strong',
|
||||||
|
array(),
|
||||||
|
$current_zone_identifier);
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormMarkupControl())
|
id(new AphrontFormMarkupControl())
|
||||||
->setLabel(pht('Current Setting'))
|
->setLabel(pht('Current Setting'))
|
||||||
->setValue($current_zone))
|
->setValue($current_zone_formatted))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSelectControl())
|
id(new AphrontFormSelectControl())
|
||||||
->setName('timezone')
|
->setName('timezone')
|
||||||
->setLabel(pht('New Setting'))
|
->setLabel(pht('New Setting'))
|
||||||
->setOptions($options)
|
->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()
|
return $this->newDialog()
|
||||||
->setTitle(pht('Adjust Timezone'))
|
->setTitle(pht('Adjust Timezone'))
|
||||||
|
@ -110,7 +120,7 @@ final class PhabricatorSettingsTimezoneController
|
||||||
$this->formatOffset($server_offset)))
|
$this->formatOffset($server_offset)))
|
||||||
->appendForm($form)
|
->appendForm($form)
|
||||||
->addCancelButton(pht('Cancel'))
|
->addCancelButton(pht('Cancel'))
|
||||||
->addSubmitButton(pht('Change Timezone'));
|
->addSubmitButton(pht('Confirm'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatOffset($offset) {
|
private function formatOffset($offset) {
|
||||||
|
|
Loading…
Reference in a new issue