fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-11 09:42 am

[dw-free] WTF community edge functions need more functionality

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

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

Clear memcache when someone joins or leaves the community, in order to
update which entries we see when we go to a community's read page (the
member list on the profile worked even before this). Also propagate upwards
the success/failure return value, just because.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/User/Edges/CommMembership.pm
--------------------------------------------------------------------------------
diff -r 92e48ffb8d08 -r f6bcfe133fe2 cgi-bin/DW/User/Edges/CommMembership.pm
--- a/cgi-bin/DW/User/Edges/CommMembership.pm	Fri Jun 11 17:27:47 2010 +0800
+++ b/cgi-bin/DW/User/Edges/CommMembership.pm	Fri Jun 11 17:48:52 2010 +0800
@@ -47,7 +47,13 @@ sub _add_m_edge {
     return 0 unless $from_u->can_join( $to_u, moderated_add => $member_edge->{moderated_add} ? 1 : 0 );
 
     # simply add the reluser edge
-    LJ::set_rel( $to_u, $from_u, 'E' );
+    my $rv = LJ::set_rel( $to_u, $from_u, 'E' );
+
+    # delete memcache key for community reading pages
+    LJ::memcache_kill( $to_u, 'c_wt_list' );
+
+    # success?
+    return $rv;
 }
 
 # internal method to delete an edge
@@ -63,6 +69,9 @@ sub _del_m_edge {
     # now remove it; note we don't do any extraneous checking.  if the user
     # wants to remove an edge that doesn't exist?  more power to them.
     LJ::clear_rel( $to_u, $from_u, 'E' );
+
+    # delete memcache key for community reading pages
+    LJ::memcache_kill( $to_u, 'c_wt_list' );
 
     # success!
     return 1;
--------------------------------------------------------------------------------