Problem/Motivation

In #3015811: Properly deprecate DRUPAL_USER_TIMEZONE_* constants we tried to move all the system module's user code to the user module but system_user_presave() proved problematic because of the interaction between filtering empty field items and when the presave hook is fired as opposed to when the entity's preSave() method is called.

Note that when this method is move to the entity class Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest fails.

Proposed resolution

Resolve difference between a NULL and '' and ensure that the timezone is set as expected.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#8 3112704-8.patch1.54 KBlongwave

Issue fork drupal-3112704

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Title: Move user_user_post_save() to User entity class » Move user_user_presave() to User entity class
Issue summary: View changes
berdir’s picture

Copying my comment from that issue:

IMHO \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::testUser() is just broken, having the timezone behavior set to setting a default but then expecting it to be '' just because it is a kernel test that didn't actually set a default timezone makes no sense :)

Also, content entity fields never have been type-safe and you can't expect that from them. $node->id() could be an integer or a string, that's just how it is atm. Same for '' vs NULL IMHO.

xjm’s picture

Version: 9.0.x-dev » 9.1.x-dev

This would be a minor-only change. Since 8.9.x and 9.0.x are now in beta, I'm moving this to 9.1.x. Thanks!

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Status: Active » Needs review
StatusFileSize
new1.54 KB

Let's see what fails.

Status: Needs review » Needs work

The last submitted patch, 8: 3112704-8.patch, failed testing. View results

berdir’s picture

Same as before, that migrate test should be changed to import the system default config so that we get an actual timezone set.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

danielveza made their first commit to this issue’s fork.

danielveza’s picture

Status: Needs work » Needs review

The test that was causing issues referenced in #3 is no longer a concern. So lets get this one in :). MR created, pipeline green.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Lets do this, then. We had an interesting case recently where we moved node logic out to hooks due to it being optional and conditional on the search module, but that is not the case here.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6bce3bb and pushed to 11.x. Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • alexpott committed 6bce3bb2 on 11.x
    Issue #3112704 by berdir, longwave: Move user_user_presave() to User...
alexpott’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.