mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-03-17 05:14 am

[dw-free] Subscription by tag not working

[commit: http://hg.dwscoalition.org/dw-free/rev/7d01195ed51a]

http://bugs.dwscoalition.org/show_bug.cgi?id=2325

Set default value for tag mode to fix bug with subscribing by tag.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/DW/User/ContentFilters/Filter.pm
--------------------------------------------------------------------------------
diff -r 568bf43b36e1 -r 7d01195ed51a cgi-bin/DW/User/ContentFilters/Filter.pm
--- a/cgi-bin/DW/User/ContentFilters/Filter.pm	Wed Mar 17 05:08:45 2010 +0000
+++ b/cgi-bin/DW/User/ContentFilters/Filter.pm	Wed Mar 17 05:14:27 2010 +0000
@@ -258,12 +258,16 @@ sub show_entry {
     # step 3) tags, but only if they actually selected some
     my @tagids = @{ $opts->{tags} || [] };
     if ( scalar @tagids > 0 ) {
+
+        # set a default/assumed value
+        $opts->{tagmode} ||= 'any_of';
+
         # we change the initial state to make the logic below easier
         my $include = {
                 none_of => 1,
                 any_of => 0,
                 all_of => 0,
-            }->{$opts->{tagmode} || 'any_of'};
+            }->{$opts->{tagmode}};
         return $fail->( 'bad_tagmode' ) unless defined $include;
 
         # now iterate over each tag and alter $include
--------------------------------------------------------------------------------