wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r19635: LJSUP-8713

Committer: wisest-owl
LJSUP-8713

U   trunk/cgi-bin/LJ/User.pm
U   trunk/htdocs/update.bml
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-08-08 08:52:44 UTC (rev 19634)
+++ trunk/cgi-bin/LJ/User.pm	2011-08-08 09:05:20 UTC (rev 19635)
@@ -3806,6 +3806,29 @@
     return LJ::SMS->can_use_sms($u);
 }
 
+sub can_use_ljphoto {
+    my $u = shift;
+
+    return 0 if $LJ::DISABLED{'new_ljphoto'};
+
+    ## For beta-testers only.
+    my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
+    return 0 unless $u->is_mutual_friend($comm);
+
+    return 1;
+}
+
+sub can_upload_photo {
+    my $u = shift;
+
+    return 0 unless $u->can_use_ljphoto();
+
+    ## Basic user has no access to ljphoto
+    return 0 if not ($u->get_cap('paid') or $u->in_class('plus') );
+
+    return 1;
+}
+
 sub ajax_auth_token {
     my $u = shift;
     return LJ::Auth->ajax_auth_token($u, @_);

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2011-08-08 08:52:44 UTC (rev 19634)
+++ trunk/htdocs/update.bml	2011-08-08 09:05:20 UTC (rev 19635)
@@ -370,9 +370,7 @@
 	
         ## Show a new photoalbums interface only for logged-in users
         my $remote = LJ::get_remote ();
-        my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
-        my $ljphoto_enabled = !$LJ::DISABLED{'new_ljphoto'} && $remote && $remote->is_mutual_friend($comm) ? 1 : 0;
-        if ($remote && $ljphoto_enabled) {
+        if ($remote && $remote->can_upload_photo()) {
             # in case of insert one photo or photo album
             my $insert_photos = [];
 
@@ -425,6 +423,7 @@
             my $user_groups = LJ::JSON->to_json (LJ::Widget::Fotki::Photo->get_user_groups ($remote));
             LJ::need_res('stc/pics/pics.css', 'js/swfupload/swfupload.js', 'js/swfupload/swfupload.queue.js', 'js/jquery/jquery.lj.photouploader.js');
 		
+            my $ljphoto_enabled = $remote->can_upload_photo();
             $$body .= <<JS;
     <script type="text/javascript">
     	window.ljphotoEnabled = $ljphoto_enabled;

Tags: bml, livejournal, pm, wisest-owl
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