verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

Guest user lists are deleted before the duration has expired #97

Closed gddotorg closed 2 years ago

gddotorg commented 2 years ago

Description For one of our customers we have integrated a bookmark function. For guest users, the bookmark list should be saved for a maximum of 30 minutes. After that, the list should be deleted. However, as soon as we want to look at the list in the BE, the guest list is no longer there. By debugging, I found out that a guest list is created, but is deleted again when the BE is loaded. The problem seems to be the timestamp, which is not stored in the database with the appropriate timezone. The difference to our local timezone is 2 hours. This causes all guest lists to be deleted when the purgeInactiveLists function is called.

Is this a bug or am I missing something?

If you need more information, just let me know.

Best regards, Georg

Steps to reproduce

  1. Set purgeInactiveGuestListsDuration to 30 minutes.
  2. As guest user add item to list.
  3. Have a look in the database (table: _wishlistlists). Guest list should be there.
  4. Load list overview page /admin/wishlist/lists/bookmarks
  5. List is no longer displayed and has been deleted from table _wishlistlists

Additional info

engram-design commented 2 years ago

Looks like you're totally correct here, in that we're not comparing UTC timestamps, which we should. In fact, we were copying what Commerce did, which is also incorrect.

Should be fixed for the next release. To get this fix early, change your verbb/wishlist requirement in composer.json to:

"require": {
  "verbb/wishlist": "dev-craft-3 as 1.4.11",
  "...": "..."
}

Then run composer update.

gddotorg commented 2 years ago

Thanks @engram-design for your quick reply. I checked your fix and it works perfect.

gddotorg commented 2 years ago

Hi there, I wanted to ask if you are planning to release a patched version.

engram-design commented 2 years ago

Sorry for the delay! Fixed in 1.4.12