Skip to content

Keep the time zone on save, let guests be saved, stop losing the first click (2.4.x) - #1006

Merged
KrzysztofPajak merged 3 commits into
2.4.xfrom
fix/2.4.x-settings-guest-click
Nov 1, 2026
Merged

KrzysztofPajak merged 3 commits into
2.4.xfrom
fix/2.4.x-settings-guest-click

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

No linked issue: these defects were found testing develop and fixed there in #1004. This brings over the three that affect every installation, MongoDB included.
Type: bugfix

Issue

  1. Saving General settings changes the store's time zone. The installer leaves DefaultStoreTimeZoneId empty, so dates follow the server, but the select has no empty option. It shows its first zone (UTC-12 on Windows), and saving the page stores that zone, whatever was being edited. Every date shown then moves.
  2. Saving a guest in the admin returns a 500. CustomerValidator calls x.Email.ToLower() and UpdateCustomerModel calls model.Email.Trim(), and a guest has no email. An empty email on any customer also shows the FluentValidation default text instead of the localized message, because WithMessage covers only EmailAddress().
  3. The first click on a form can be lost. On the login page the email field is autofocused. Pressing the login button takes focus away, the validation message appears on mousedown and moves the layout, so the button is no longer under the pointer on mouseup and no click happens.

Solution

  1. GetStoreTimeZoneOptions adds an empty "Server time zone" option, used by the Admin and Store settings pages. Saving it keeps the value empty, so the store keeps following the server. A configured zone that resolves but is not listed, such as a Windows id on Linux, gets its own option so that saving does not change it.
  2. The email stays required unless the customer has none stored and is not being moved to the Registered group. Both null dereferences are guarded, and the required rule has its own localized message.
  3. Leaving an untouched empty field, unticked checkbox or empty checkbox group reports nothing. Submitting still validates, and so does typing.

Different from #1004: the new resource is in DefaultLanguage.xml and en_240.xml, but a database already on 2.4 does not run the 2.4 resource import again. The option therefore reads the resource with the default text "Server time zone", so those installations see that text and not a raw key. On develop the resource arrives through en_250.xml, so this default is not needed there.

Not included: the LiteDB fixes from #1004 and #997 (mapper warm-up, installation, null guards in the gift voucher and order filters, removal of the Singleton option).

Breaking changes

None. GeneralCommon in the Admin panel gains a [FromServices] parameter, which MVC supplies. No model, route, setting or stored field changes. A store that already saved a zone keeps it, because that cannot be told from a deliberate choice; choosing "Server time zone" and saving clears it.

Testing

On a MongoDB install:

  1. Time zone: on a fresh install open Configuration > Settings > General settings. The time zone shows "Server time zone: ...". Save the page and reopen it: it still shows that option. Choose a zone, save, reopen: it shows that zone. Choose "Server time zone" again, save, reopen: it shows that option.
  2. Guest: browse the storefront in a private window and open a second page, so the guest is stored. In the admin open that guest from Customers > Online customers, set an admin comment and save. The save succeeds and the email stays empty.
  3. First click: sign out and open /login without touching anything. Press and hold the login button with the mouse: nothing moves. Release it: the click registers and the required messages appear.
  4. Checkbox: enable "Accept privacy policy" in the customer settings, open /register, tab past the checkbox: no message. Submit the form: the message appears.

Automated: all test projects in GrandNode.slnx pass, with new tests in CustomerValidatorTests, CustomerViewModelServiceTests and DateTimeServiceExtensionsTests. A guest moved to the Registered group without an email is covered there.

Steps 1 to 4 were also run on this branch against MongoDB, on a database without the new resource. Login click, measured with a real mouse press: before the fix the button moved 24 px and no click happened; after it the button stayed put and the click registered. The Store panel's settings page was not opened in a browser; it uses the same helper.

support added 3 commits November 1, 2026 07:33
The installer leaves the store's time zone empty, so dates follow the server,
but the select had no empty option. It showed its first zone, and saving General
settings stored that zone, moving every date shown. An empty option keeps the
value empty. A configured zone that resolves but is not listed, such as a Windows
id on Linux, gets its own option so that saving does not change it.

The option's text has a default: a database already on 2.4 does not import the
2.4 resources again.
The edit validator lowercased the posted email and the update trimmed it without
checking it, so saving a guest, who has none, returned a 500. The email is now
required unless the customer has none stored and is not being moved to the
Registered group. The required message is also localized now: WithMessage covered
only EmailAddress, so an empty field showed the FluentValidation default.
The message appeared on mousedown, when an autofocused field lost focus, and moved
the layout. The button under the pointer slid away before mouseup and the click
was lost, on the login page among others. An untouched empty field, unticked
checkbox or empty group now reports nothing until the form is submitted.
@KrzysztofPajak
KrzysztofPajak merged commit 019fd31 into 2.4.x Nov 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant