Good Morning,

Having set up a relation for a specific flag with the view (looking for content with a global flag), it would appear as though "All" does not work properly.

All comes through as the value (at least configured here) as "All" which instead becomes true and ends up becoming an IS NULL query fragment, as such causing filtering when the intention is to do none.

Comments

dan.munn created an issue. See original summary.

dan.munn’s picture

StatusFileSize
new833 bytes
dan.munn’s picture

Status: Active » Needs review
joachim’s picture

+++ b/includes/views/flag_handler_filter_flagged.inc
@@ -31,7 +31,10 @@ class flag_handler_filter_flagged extends views_handler_filter_boolean_operator
+    if (is_numeric($this->value)) {
+      $operator = $this->value ? 'IS NOT' : 'IS';

I'm a bit perturbed by the code checking a variable is numeric, and then a moment later treating it as a boolean...

dan.munn’s picture

In this particular case 0 is false, 1 is true, but by the original logic "All" is also true - I can rewrite the patch with something a little more tactful vs that mechanism of checking.

joachim’s picture

I wonder whether the problem is actually the values we're using.

Views's own InOperator looks like this:

  protected function opSimple() {
    if (empty($this->value)) {
      return;
    }

An empty value here means don't filter, but we're using it to mean 'unflagged'. Is that an inconsistency we should fix?

dan.munn’s picture

StatusFileSize
new830 bytes

So, looking further into the 5 minutes I gave it earlier, looks like a boolean comparison is better placed then due to the execution of accept_exposed_input, ultimately making the value FALSE.

Revised patch attached which keeps things as a boolean instead - note the value 0 still comes through as expected.

ivnish’s picture

Status: Needs review » Closed (outdated)

Drupal 7 is EOL. Issue will be closed, but patches are still here