Problem/Motivation

flag_views_query_substitutions() includes a condition to only work on the query, when the view includes a flag relationship.

But !in_array('flagging', $view->getBaseTables()) is always TRUE, since $view->getBaseTables() returns an array where all values equal TRUE, and where the table names are actually the keys.

Steps to reproduce

  • Enable the flag module.
  • Navigate to any page including a view.
  • flag_views_query_substitutions() gets executed and the condition is verified.

Proposed resolution

Replace the check with one using array_key_exists()

Remaining tasks

Make the edit and create a MR.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork flag-3560125

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

arousseau created an issue. See original summary.

arousseau’s picture

Issue summary: View changes
Status: Active » Needs review
deaom’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm this is happening. Checked on the admin/content view and the condition is always true. MR solved the issue.

ivnish made their first commit to this issue’s fork.

  • ivnish committed 324cf76d on 5.x authored by arousseau
    fix: #3560125 flag_views_query_substitutions gets executed even when the...
ivnish’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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