hispanic / staticwoman

A fork of Staticman that provides additional functionality.
https://staticman.net
MIT License
7 stars 2 forks source link

Allow for bypassing Akismet spam-checking (when testing) #10

Closed hispanic closed 3 years ago

hispanic commented 3 years ago

This addresses https://github.com/eduardoboucas/staticman/issues/404 - "Allow for bypassing Akismet spam-checking (when testing)"

One new config option has been added to the JSON-based config:

    bypassValue: {
      doc: 'Value to pass in as comment author, author email, author URL, or content in order to bypass Akismet spam-checking. Intended to be used for testing in lieu of disabling Akismet via the site config.',
      format: String,
      default: null,
      env: 'AKISMET_BYPASS_VALUE'
    }

In Staticman, currently, Akismet spam-checking is turned on/off via the akismet.enabled property in the site config. When running Staticman in a testing, staging, or production environment, it would help facilitate testing if there was a per-request way to bypass Akismet spam-checking. Pumping too many test comments through Akismet (the free plan that does not allow for any review) can result in Akismet flagging test data as spam.

With this change, if the author name, author email, author url, or comment content are set to the bypass value, Akismet will not be invoked for the submission. This allows Akismet to remain enabled, but bypass-able by in-the-know testers.