Problem/Motivation

The group filter functionality on the content management page causes an error when the Group module is installed but not the Group Node child module.

Steps to reproduce

- Have a Drupal 8 site with the Lingotek module installed and setup along with the Group module also setup for users. The Group Node module should not be installed.
- Attempt to use the "Group" filter on the content management page.
- The page will error and the user is then unable to access the content management page again.

Error Message
Drupal\Core\Database\InvalidQueryException: Query condition 'group_content.type IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 105 of core/lib/Drupal/Core/Database/Query/Condition.php).

Proposed resolution

I think this issue might be solvable if rather than checking for the Group module before enabling the group filter, the module should instead check for the Group Node module as it looks like filtering by group may currently assume groups are configured for nodes anyway.

Remaining tasks

n/a

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

Ben-Ryder created an issue. See original summary.

ben-ryder’s picture

StatusFileSize
new613 bytes

Added an initial patch file based on my suggested fix.

In isolation on the site I found this issue on, this stops the group filter being displayed as expected.
When I installed the group node module (gnode) the filter is then shown as expected.

penyaskito’s picture

Status: Active » Needs review

Thanks for the patch!

ben-ryder’s picture

No problem, happy to help.

During some more testing I found I'd missed two other occurrences of that module check, so my latest patch includes the same change for those occurrences too. My mistake!

Also sorry for the mismatch in comment vs patch file number now, I didn't see your comment until I'd uploaded my new patch :)

Status: Needs review » Needs work

The last submitted patch, 4: lingotek-group_filter_issue-3199144-3.patch, failed testing. View results

penyaskito’s picture

Thanks a lot for the new patch!
Code looks good.
Added fix for the failing unit test, that needed to be adapted.
Added a new test for testing this new specific scenario.

Added only-tests patch that should fail, to show that you fixed the problem.

penyaskito’s picture

Tests passed and failed as expected.

hlopez’s picture

Status: Needs review » Reviewed & tested by the community

Tested and reviewed patch. Looks good, thanks!

  • penyaskito committed d7fb26b on 3.5.x authored by Ben-Ryder
    Issue #3199144 by Ben-Ryder, penyaskito, hlopez: Group filter causes...
penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

Committed d7fb26b and pushed to 3.5.x. Thanks!
Cherry-picked 0a614b9 and pushed to 3.6.x. Thanks!

  • penyaskito committed 0a614b9 on 3.6.x authored by Ben-Ryder
    Issue #3199144 by Ben-Ryder, penyaskito, hlopez: Group filter causes...

Status: Fixed » Closed (fixed)

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