fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-05-16 09:32 am

[dw-free] Add Option to Transfer Points to Give a Gift Page

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

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

Add link to transfer points (personal journals only).

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/User.pm
  • htdocs/shop/gifts.bml
  • htdocs/shop/gifts.bml.text
--------------------------------------------------------------------------------
diff -r c042ca0506c8 -r 57857f57e558 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon May 16 17:14:31 2011 +0800
+++ b/cgi-bin/LJ/User.pm	Mon May 16 17:32:32 2011 +0800
@@ -2355,6 +2355,11 @@
     return "$LJ::SITEROOT/shop/points?for=" . $u->user;
 }
 
+# returns the gift shop URL to transfer your own points to that user
+sub transfer_points_url {
+    my ( $u ) = @_;
+    return "$LJ::SITEROOT/shop/transferpoints?for=" . $u->user;
+}
 
 =head3 C<< $self->give_shop_points( %options ) >>
 
diff -r c042ca0506c8 -r 57857f57e558 htdocs/shop/gifts.bml
--- a/htdocs/shop/gifts.bml	Mon May 16 17:14:31 2011 +0800
+++ b/htdocs/shop/gifts.bml	Mon May 16 17:32:32 2011 +0800
@@ -79,7 +79,12 @@
         $ret .= " [<a href='" . $person->gift_url . "'>";
         $ret .= LJ::Lang::ml( '.buy.gift' ) . "</a>]";
         $ret .= " [<a href='" . $person->gift_points_url . "'>";
-        $ret .= LJ::Lang::ml( '.buy.points' ) . "</a>]</li>\n";
+        $ret .= LJ::Lang::ml( '.buy.points' ) . "</a>]";
+        if ( $person->is_personal && ! $person->equals( $remote ) ) {
+            $ret .= " [<a href='" . $person->transfer_points_url . "'>";
+            $ret .= LJ::Lang::ml( '.buy.points.transfer' ) . "</a>]";
+        }
+        $ret .= "</li>\n";
 
         return $ret;
     };
diff -r c042ca0506c8 -r 57857f57e558 htdocs/shop/gifts.bml.text
--- a/htdocs/shop/gifts.bml.text	Mon May 16 17:14:31 2011 +0800
+++ b/htdocs/shop/gifts.bml.text	Mon May 16 17:32:32 2011 +0800
@@ -5,6 +5,8 @@
 
 .buy.points=Buy points
 
+.buy.points.transfer=Transfer points
+
 .free.about=These are the people in your Circle who have free accounts and might appreciate the chance to try out some of our <a [[aopts]]>paid features</a>: 
 
 .free.header=Free Accounts
--------------------------------------------------------------------------------