[dw-free] periodic inability to join communities
[commit: http://hg.dwscoalition.org/dw-free/rev/17ca5b4d2b8b]
http://bugs.dwscoalition.org/show_bug.cgi?id=1139
Operating on edges is a 'best effort' thing, so don't return immediately on
failure. Still return the status, though.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1139
Operating on edges is a 'best effort' thing, so don't return immediately on
failure. Still return the status, though.
Patch by
Files modified:
- cgi-bin/DW/User/Edges.pm
--------------------------------------------------------------------------------
diff -r fb8df8611779 -r 17ca5b4d2b8b cgi-bin/DW/User/Edges.pm
--- a/cgi-bin/DW/User/Edges.pm Mon Jun 08 15:02:22 2009 +0000
+++ b/cgi-bin/DW/User/Edges.pm Tue Jun 09 16:25:55 2009 +0000
@@ -168,6 +168,7 @@ sub add_edge {
# now we try to add these edges. note that we do this in this way so that
# multiple edges can be consumed by one add sub.
my @to_add = keys %edges;
+ my $ok = 1;
while ( my $key = shift @to_add ) {
# some modules will define multiple edges, and so one call to add_sub might
@@ -178,11 +179,11 @@ sub add_edge {
# simply calls an add_sub to handle the edge. we expect them to remove the
# edge from the hashref if they process it.
my $success = $DW::User::Edges::VALID_EDGES{$key}->{add_sub}->( $from_u, $to_u, \%edges );
- return 0 unless $success;
+ $ok &&= $success; # will zero out if any edges fail
}
# all good
- return 1;
+ return $ok;
}
# removes an edge between two users
@@ -200,6 +201,7 @@ sub remove_edge {
# now we try to remove these edges. note that we do this in this way so that
# multiple edges can be consumed by one remove sub.
my @to_del = keys %edges;
+ my $ok = 1;
while ( my $key = shift @to_del ) {
# some modules will define multiple edges, and so one call to add_sub might
@@ -210,11 +212,11 @@ sub remove_edge {
# simply calls an add_sub to handle the edge. we expect them to remove the
# edge from the hashref if they process it.
my $success = $DW::User::Edges::VALID_EDGES{$key}->{del_sub}->( $from_u, $to_u, \%edges );
- return 0 unless $success;
+ $ok &&= $success; # will zero out if any edges fail
}
# all good
- return 1;
+ return $ok;
}
# and now we link these into the LJ::User namespace for backwards compatibility
--------------------------------------------------------------------------------
