Problem/Motivation

If a webform submission results in a failed mailchimp submission, we only have a global dblog error report.
Webform admins do likely not check this global log.

Additionally, even if logging is enabled, the submission neither reports success or error into the webform log.
In contrast, the email submission handler does report success.

This makes the whole integration a blackbox with unknown reliability for regular users / non-technical admins.

Proposed resolution

In case of submission error, always log to the webform log.

In case logging is enabled, also log success.

Remaining tasks

Discuss, decide, implement.

User interface changes

API changes

Data model changes

Comments

miro_dietiker created an issue. See original summary.

mbovan’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

Additionally, even if logging is enabled, the submission neither reports success or error into the webform log.
...
In case logging is enabled, also log success.

AFAICS, webform module provides a (webform) log as "submission created" if logging is enabled. Do you mean we should add an additional webform log record in case a Mailchimp submission succeed?

In case of submission error, always log to the webform log.

The webform logs/log tab is only displayed if submissions are being logged.

However, this seems to be tricky to do properly with the current code.

The main limitation is that WebformMailChimpHandler uses mailchimp_subscribe() helper which does not provide enough information when an error occurs. There is an issue in Mailchimp module that aims to improve this behavior #2821953: Introduce a mailchimp service, and expose API exceptions to service users.

The attached patch creates a webform log record in case Mailchimp subscriptions fails. As we don't know why Mailchimp subscription failed the current message is: An error occurred subscribing @email to list @list.

In order to have the actual reason, we could improve it once #2821953: Introduce a mailchimp service, and expose API exceptions to service users. lands. The other (workaround) option could be to query mailchimp watchdog records by email/list_id and create a webform log record based on it.

miro_dietiker’s picture

Status: Needs review » Needs work

This still doesn't report success similar to the e-mail handler. Please double check that.

Also checkout admin/structure/webform/submissions/log - the global webform log is not dependent on a specific form setting.. and to me it also seems that it does not depent to the global setting.

I would vote against workarounds and promote (and help solve) the original issues.

berdir’s picture

Discussed with Miro, to make sure that there are no misunderstandings here:

* Always log failures
* Log success *if* the log submissions checkbox is enabled.
* Do not work on #2821953: Introduce a mailchimp service, and expose API exceptions to service users. (as much as I would love to refactor that code), do not implement any workarounds, this is good enough for a first version. Lets just add "Check the logs for details." to the log message, search_api does this in a similar way.

mbovan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.36 KB
new1.63 KB

Ok, adding success webform log if any sort of logging is enabled (either global or form logging).

Also checkout admin/structure/webform/submissions/log - the global webform log is not dependent on a specific form setting.. and to me it also seems that it does not depent to the global setting.

It looks like this page does not depend on logging setting indeed. However, it can produce 403's when a user tries to access detail submission log records (in case logging was not enabled).

miro_dietiker’s picture

Wonderful. Let's test this in prod... ;-)

How about creating some issue for the inconsistent permission check?

mbovan’s picture

Updated the message with: An error occurred subscribing @email to list @list. Check the logs for details.. Check the logs for details could be confusing IMHO, as a user is going to see this on the global-webform-logging overview page.

Created #2933933: Inconsistent access checks for log overviews in webform project.

berdir’s picture

Not quite sure about the wording yet, because we are in the logs already. Maybe system logs or so, but lets wait and test this a bit on some sites before we finalize that text and commit it.

miro_dietiker’s picture

Status: Needs review » Needs work

I accidentally enabled the MailChimp cron queue processing (label is "use batch processing") at admin/config/services/mailchimp

This makes mailchimp_subscribe() always succeed and then later failing silently (yes with dblog record) if something was wrong.
However, Mailchimp won't know about that.

Thus the log message above should adapt the success message with a reference to the queue, if the checkbox is enabled.

  • "@email has been subscribed to list @list." => "@email subscription to list @list added to queue."
  • "mailchimp subscribe success" => "mailchimp subscribe enqueue"
primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB

Log entry updated.

primsi’s picture

miro_dietiker’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

Committed this.

  • miro_dietiker committed 7450be8 on 8.x-5.x authored by Primsi
    Issue #2932605 by mbovan, Primsi, miro_dietiker: Submission handler...

Status: Fixed » Closed (fixed)

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