-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Connectors: Register Akismet Anti-Spam as a default connector #11399
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
Changes from all commits
ac3fe5b
f95efa6
e24a27a
b064a01
4adb201
d5ed60e
de1e3ec
04f9e5f
f748fa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,6 +210,25 @@ function _wp_connectors_init(): void { | |
| _wp_connectors_register_default_ai_providers( $registry ); | ||
| } | ||
|
|
||
| // Non-AI default connectors. | ||
| $registry->register( | ||
| 'akismet', | ||
| array( | ||
| 'name' => __( 'Akismet Anti-spam' ), | ||
| 'description' => __( 'Protect your site from spam.' ), | ||
| 'type' => 'spam_filtering', | ||
| 'plugin' => array( | ||
| 'file' => 'akismet/akismet.php', | ||
| ), | ||
| 'authentication' => array( | ||
| 'method' => 'api_key', | ||
| 'credentials_url' => 'https://akismet.com/get/', | ||
| 'setting_name' => 'wordpress_api_key', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have been
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bluefuton, what can we do to align on the setting name and const name for Akismet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gziolo It seems sensible to migrate to a new option name like |
||
| 'constant_name' => 'WPCOM_API_KEY', | ||
| ), | ||
| ) | ||
| ); | ||
|
|
||
| /** | ||
| * Fires when the connector registry is ready for plugins to register connectors. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11011,6 +11011,12 @@ mockedApiResponse.Schema = { | |
| "PATCH" | ||
| ], | ||
| "args": { | ||
| "wordpress_api_key": { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorgefilipecosta, I was thinking about it. Akismet is using a custom setting name, which means they already control it and register themselves. In that case, I think it's fair to assume that WP core doesn't need to handle it. If it is needed for testing purposes, we can always mock it for individual tests. Concluding, let's auto-register the setting name only when not set explicitly. AI is a bit awkward in that regard, so maybe we can add a special case there, too.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, does the setting need to be registered before plugin installation for JS to function properly?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I investigate it further, and it looks like the setting gets registered only if the plugin doesn't do it earlier. It seems like a sound approach. In that case, it's only the fallback in WP core. Unfortunately, I can't think of a simple way to prevent such registration when Akismet isn't installed. Well, what I said earlier still holds. However, it might not be trivial to achieve such a goal. |
||
| "title": "Akismet Anti-spam API Key", | ||
| "description": "API key for the Akismet Anti-spam connector.", | ||
| "type": "string", | ||
| "required": false | ||
| }, | ||
| "title": { | ||
| "title": "Title", | ||
| "description": "Site title.", | ||
|
|
@@ -14544,6 +14550,7 @@ mockedApiResponse.CommentModel = { | |
| }; | ||
|
|
||
| mockedApiResponse.settings = { | ||
| "wordpress_api_key": "", | ||
| "title": "Test Blog", | ||
| "description": "", | ||
| "url": "http://example.org", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this part is relevant the rest is Gutenberg ref update which is included for testing but will not be part of the commit.