"Report to Akismet and unpublish" not working on Comments

Created on 12 April 2022, about 3 years ago
Updated 9 April 2023, about 2 years ago

Problem/Motivation

The action "Report to Akismet and unpublish" is not working on comments. The comment is not sent to Akismet and the comment is not unpublished. Instead, this error is returned: "No access to execute Report to Akismet and unpublish on the Comment ...."

Steps to reproduce

- Add the comment form to the list of Akismet forms in Akismet settings.
- Go to /admin/content/comment/, select a comment you want to mark as spam, choose "Report to Akismet and unpublish" in the Action seelct list and choose "Apply to selected items".

Proposed resolution

The problem is in the access function in UnpublishReportComment.php. The value set to $form_id is incorrect.
In hook 'comment_akismet_form_list' in akismet.module, the form_id is set to `'comment_' . $type->id() . '_form'`, but in the access function it is set to `'comment_' . $node->getEntityTypeId() . '_' . $node->bundle() . '_form'`, while this should be `'comment_' . $object->getTypeId() . '_form'`.

Remaining tasks

- fix bug
- test
- commit

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇳🇱Netherlands mvbaalen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024