Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preconfirm_subscriptions only implemented for POST, not PUT #426

Closed
totycro opened this issue Aug 2, 2021 · 1 comment
Closed

preconfirm_subscriptions only implemented for POST, not PUT #426

totycro opened this issue Aug 2, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@totycro
Copy link

totycro commented Aug 2, 2021

Version:

  • listmonk: 1.1.0
  • OS: Docker

Description of the bug and steps to reproduce:
When adding a list to a subscriber via the PUT endpoint with preconfirm_subscriptions, the list subscriptions won't be confirmed and also a confirmation email is sent.

Checking for preconfirmation is currently only implemented for the POST endpoint, i.e. here:
https://github.com/knadh/listmonk/blob/master/cmd/subscribers.go#L682

Probably, there should be something like if !req.PreconfirmSubs { before this line, as well as setting the confirmation status for these subscriptions:
https://github.com/knadh/listmonk/blob/master/cmd/subscribers.go#L348

Steps to reproduce
For a user having e.g. no list subscriptions, this call will create unconfirmed subscriptions and send out emails:

curl -v https://mylistmonk/api/subscribers/82 -X PUT -H "Content-Type: application/json" -d '{"email": "[email protected]", "name": "foo", "status": "enabled", "lists": [2], "preconfirm_subscriptions": true}'

This call however will create confirmed subscriptions and not send emails:

curl -v https://mylistmonk/api/subscribers -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]", "name": "foo "status": "enabled", "lists": [2], "preconfirm_subscriptions": true}'
@totycro totycro added the bug Something isn't working label Aug 2, 2021
@knadh
Copy link
Owner

knadh commented Aug 2, 2021

Thanks for reporting this. Fixed on the develop branch: e656618

@knadh knadh closed this as completed Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants