verbb / back-in-stock

Back in stock plugin for Craft Commerce that notifies subscribed users via an automated email
Other
3 stars 8 forks source link

Possible to save multiple logs for same email using different letter case #33

Open jmauzyk opened 1 week ago

jmauzyk commented 1 week ago

Describe the bug

If a log already exists for a specific variant ID with an email address (e.g., myemail@site.com), any attempt to register interest again using the exact same email address fails validation, as expected.

However, if the same email address is entered with different letter casing (e.g., myEmail@Site.com), it is saved as a new record. This behavior can result in duplicate notifications being sent when the variant returns to stock.

Steps to reproduce

  1. Register interest for a product using an email.
  2. Attempt to register interest for a product but change the letter case for some characters in the email address.
  3. Interest is logged rather than returning validation error.

Craft CMS version

4.13.2

Plugin version

3.0.3

Multi-site?

Yes

Additional context

DB driver is PostgreSQL 14

engram-design commented 5 days ago

Ah, looks like a Postgres-specific issue. Fixed for the next release. To get this early, run composer require verbb/back-in-stock:"dev-craft-4 as 3.0.3".