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

[dw-free] syn_merge console command should prevent merging a feed to itself

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

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

Error-checking: don't allow merging into yourself. You are already yourself.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Console/Command/SynMerge.pm
--------------------------------------------------------------------------------
diff -r 3d8b759e2c60 -r fd48661e6d2e cgi-bin/LJ/Console/Command/SynMerge.pm
--- a/cgi-bin/LJ/Console/Command/SynMerge.pm	Fri Aug 13 09:42:28 2010 +0800
+++ b/cgi-bin/LJ/Console/Command/SynMerge.pm	Sat Aug 14 17:44:03 2010 +0800
@@ -51,6 +51,9 @@ sub execute {
 
     my $to_u = LJ::load_user($to_user)
         or return $self->error("Invalid user: '$to_user'.");
+
+    return $self->error( "Trying to merge into yourself: '$to_user'." )
+        if $from_u->equals( $to_u );
 
     # we don't want to unlimit this, so reject if we have too many users
     my @ids = $from_u->watched_by_userids( limit => $LJ::MAX_WT_EDGES_LOAD+1 );
--------------------------------------------------------------------------------