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-03-26 06:47 am

[dw-free] Deleting filters doesn't work

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

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

The 'trust_groups' table is clustered, so make sure to use the proper
cluster handle. Also change one usage of $dbcm to use $u.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/User/Edges/WatchTrust.pm
--------------------------------------------------------------------------------
diff -r ff18441d8009 -r 74e2b728352f cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm	Wed Mar 25 06:30:16 2009 +0000
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm	Thu Mar 26 06:47:02 2009 +0000
@@ -764,11 +764,9 @@ sub edit_trust_group {
         if exists $opts{is_public} && $opts{is_public} =~ /^(?:0|1)$/;
 
     # update the database
-    my $dbcm = LJ::get_cluster_master( $u )
-        or confess 'unable to connect to user cluster master';
-    $dbcm->do( 'REPLACE INTO trust_groups (userid, groupnum, groupname, sortorder, is_public) VALUES (?, ?, ?, ?, ?)',
-               undef, $u->id, $id, $change{groupname}, $change{sortorder} || 50, $change{is_public} || 0 );
-    confess $dbcm->errstr if $dbcm->err;
+    $u->do( 'REPLACE INTO trust_groups (userid, groupnum, groupname, sortorder, is_public) VALUES (?, ?, ?, ?, ?)',
+            undef, $u->id, $id, $change{groupname}, $change{sortorder} || 50, $change{is_public} || 0 );
+    confess $u->errstr if $u->err;
 
     # kill memcache and return
     LJ::memcache_kill( $u, 'trust_group' );
@@ -845,11 +843,11 @@ sub delete_trust_group {
     }
 
     # finally remove the trust group, huzzah
-    $dbh->do(
+    $u->do(
         q{DELETE FROM trust_groups WHERE userid = ? AND groupnum = ?},
         undef, $u->id, $bit
     );
-    return 0 if $dbh->err;
+    return 0 if $u->err;
 
     # invalidate memcache of friends/groups
     LJ::memcache_kill( $u->id, "trust_group" );
--------------------------------------------------------------------------------