Skip to content
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

Condition plugins are sometimes being double-negated #1325

Closed
qadan opened this issue Nov 5, 2019 · 2 comments
Closed

Condition plugins are sometimes being double-negated #1325

qadan opened this issue Nov 5, 2019 · 2 comments
Milestone

Comments

@qadan
Copy link

qadan commented Nov 5, 2019

Looking through the various plugins in \Drupal\islandora\Plugin\Condition - occasionally, $this->isNegated() is being referenced somewhere during the evaluate() process to feed a ternary returning either TRUE or FALSE, thereby handling the negation as part of the evaluation.

The problem is, Drupal core runs isNegated() after calling the condition plugin's evaluate() to accomplish the same thing in an identical ternary, so what ends up happening is if you decide to negate an affected condition, Islandora will negate the condition, and then Drupal will go ahead and un-negate it for you immediately afterwards, making it impossible to negate some filters.

This isn't consistently applied across all conditions, so some are unaffected (e.g., ContentEntityType and FileUsesFilesystem).

STR:

To check an affected filter:

  • Create a context
  • Add a condition that checks for Node has term
  • Add the term Collection
  • Check the "Negate the condition" box
  • Add a reaction of some kind; for simple testing purposes, I simply added one that changes the theme from Carapace to something else
  • Navigate to a collection, as well as a Repository Item that isn't a collection
  • Note that the reaction is fulfilled in both cases

Expected behaviour:

Checking off the "Negate the condition" box for a context condition should invert the conditions whereby that context is met.

@dannylamb
Copy link
Contributor

PR up for the rest of the conditions ^^

@seth-shaw-unlv
Copy link
Contributor

Resolved with Islandora/islandora@c89ff9f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants