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] changelog2009-09-30 04:48 am

[dw-free] Adding duplicate subscription filter fails silently

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

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

Fix so if you try to create a new subscription filter with the same name as
an existing one, it doesn't enter the Twilight Zone and instead lets you
edit your existing filter.

Patch by [personal profile] yvi.

Files modified:
  • cgi-bin/DW/User/ContentFilters.pm
  • htdocs/img/customize/previews/drifting/chocalatecherry.png
--------------------------------------------------------------------------------
diff -r 11c0f57d8db2 -r c8b7141976ac cgi-bin/DW/User/ContentFilters.pm
--- a/cgi-bin/DW/User/ContentFilters.pm	Wed Sep 30 04:40:09 2009 +0000
+++ b/cgi-bin/DW/User/ContentFilters.pm	Wed Sep 30 04:48:18 2009 +0000
@@ -107,9 +107,9 @@ sub create_content_filter {
     # FIXME: this is probably the point we should implement limits on how many
     # filters you can create...
 
-    # check if a filter with this name already exists
+    # check if a filter with this name already exists, if so return its id, so the user can edit or remove it
     my $name = LJ::trim( LJ::text_trim( delete $args{name}, 255, 100 ) ) || '';
-    return undef
+    return $u->content_filters( name => $name )->id
         if $u->content_filters( name => $name );
 
     # we need a filterid, or #-1 FAILURE MODE IMMINENT
diff -r 11c0f57d8db2 -r c8b7141976ac htdocs/img/customize/previews/drifting/chocalatecherry.png
Binary file htdocs/img/customize/previews/drifting/chocalatecherry.png has changed
--------------------------------------------------------------------------------