ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[ljcom] r9778: LJSUP-7377: Wishlist

Committer: ssafronova
LJSUP-7377: Wishlist
U   trunk/cgi-bin/LJ/Hooks/SUP.pm
Modified: trunk/cgi-bin/LJ/Hooks/SUP.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/SUP.pm	2010-12-01 10:55:06 UTC (rev 9777)
+++ trunk/cgi-bin/LJ/Hooks/SUP.pm	2010-12-01 11:38:26 UTC (rev 9778)
@@ -989,6 +989,24 @@
     }
 });
 
+LJ::register_hook("postpost", sub {
+    my $arg = shift;
+    return undef unless $arg;
 
+    my $remote = LJ::get_remote();
+    return unless $remote;
 
+    if ($arg->{event} =~ /<lj-wishlist\s+wishid=['"](\d+)["']\s+userid=['"](\d+)['"]\s*\/?>/) {
+        my $wishid = $1;
+        my $userid = $2;
+        return unless $remote->userid eq $userid; # we will alter only your own wishlist
+
+        my $wish = LJ::WishElement->load($remote, $wishid);
+        return unless $wish;
+        $wish->update({ ditemid => $arg->{itemid} * 256 + $arg->{anum} });
+    }
+
+});
+
+
 1;

Tags: ljcom, pm, ssafronova
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