madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r19356: LJSV-1441 fix: Interest counter can't be...

Committer: sbelyaev
LJSV-1441 fix: Interest counter can't be decreased when it's already 0.
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/LJ/Widget/FriendInterests.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-06-24 06:11:46 UTC (rev 19355)
+++ trunk/cgi-bin/LJ/User.pm	2011-06-24 06:18:05 UTC (rev 19356)
@@ -7813,7 +7813,7 @@
         ## easy, we know their IDs, so delete them en masse
         my $intid_in = join(", ", values %int_del);
         $dbh->do("DELETE FROM $uitable WHERE userid=$userid AND intid IN ($intid_in)");
-        $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in)");
+        $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in) AND intcount > 0");
         $did_mod = 1;
     }
 

Modified: trunk/cgi-bin/LJ/Widget/FriendInterests.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/FriendInterests.pm	2011-06-24 06:11:46 UTC (rev 19355)
+++ trunk/cgi-bin/LJ/Widget/FriendInterests.pm	2011-06-24 06:18:05 UTC (rev 19356)
@@ -42,7 +42,7 @@
         my $dbh = LJ::get_db_writer();
         $dbh->do("DELETE FROM $uitable WHERE userid=? AND intid IN ($intid_in)",
                  undef, $u->id);
-        $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in)");
+        $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in)  AND intcount > 0");
         $deleted = 1;
     }
     if (@toadd) {

Tags: livejournal, madeon, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments