mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-10-21 05:50 pm

[dw-free] "Last updated" section on Manage Circle page

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

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

Move last_updated call to LJ::User object and add it to Manage Circle page
so you can see at a glance when everybody last updated.

Patch by [staff profile] denise.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/User.pm
  • htdocs/manage/circle/edit.bml
  • htdocs/userinfo.bml
--------------------------------------------------------------------------------
diff -r 111e14d6588c -r 20e8d4c481b8 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Wed Oct 21 17:44:23 2009 +0000
+++ b/bin/upgrading/en.dat	Wed Oct 21 17:50:20 2009 +0000
@@ -2167,6 +2167,10 @@ label.warning=Warning:
 
 langname.en=English
 
+lastupdated.ago=last updated [[timestamp]] ([[agotext]])
+
+lastupdated.never=never updated
+
 ljfeedback.text=Like to vote?  Join [[journal]] where we post polls and surveys that help influence and improve LJ.
 
 ljlib.pageofpages=Page [[page]] of [[total]]
diff -r 111e14d6588c -r 20e8d4c481b8 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Oct 21 17:44:23 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Wed Oct 21 17:50:20 2009 +0000
@@ -699,6 +699,25 @@ sub journaltype_readable {
     }->{$u->journaltype};
 }
 
+sub last_updated {
+    # Given a user object, returns a string detailing when that journal
+    # was last updated, or "never" if never updated.
+
+    my ( $u ) = @_;
+
+    return undef unless $u -> is_person || $u->is_community;
+
+    my $lastupdated = substr( LJ::mysql_time( $u->timeupdate ), 0, 10 );
+    my $secondsold = time() - $u->timeupdate;
+    my $ago_text = LJ::ago_text( $secondsold );
+
+    if ( $u->timeupdate ) {
+        return LJ::Lang::ml( 'lastupdated.ago', 
+            { timestamp => $lastupdated, agotext => $ago_text });
+    } else {
+        return LJ::Lang::ml ( 'lastupdated.never' );
+    }
+}
 
 # returns LJ::User class of a random user, undef if we couldn't get one
 #   my $random_u = LJ::User->load_random_user(type);
diff -r 111e14d6588c -r 20e8d4c481b8 htdocs/manage/circle/edit.bml
--- a/htdocs/manage/circle/edit.bml	Wed Oct 21 17:44:23 2009 +0000
+++ b/htdocs/manage/circle/edit.bml	Wed Oct 21 17:50:20 2009 +0000
@@ -94,7 +94,7 @@ body<=
                     $ret .= "<td scope='col' abbr='" . $other_u->display_username . "'>";
                     $ret .= LJ::html_hidden( "editfriend_edit_${uid}_user" => 1 );
                     $ret .= $other_u->ljuser_display;
-                    $ret .= "<br /><span style='font-size: smaller;'>" . LJ::last_updated( $other_u ) . "</span>";
+                    $ret .= "<br /><span style='font-size: smaller;'>" . $other_u->last_updated . "</span>";
                     $ret .= "</td>";
 
                     # color
diff -r 111e14d6588c -r 20e8d4c481b8 htdocs/userinfo.bml
--- a/htdocs/userinfo.bml	Wed Oct 21 17:44:23 2009 +0000
+++ b/htdocs/userinfo.bml	Wed Oct 21 17:50:20 2009 +0000
@@ -394,17 +394,7 @@ body<=
     unless ( $u->is_identity ) {
         my $jcdate = BML::ml( '.details.createdon2', 
             { createdate => LJ::mysql_time( $u->timecreate )  } );
-        $ret .= "<p>$jcdate (#" . $u->id . ')';
-
-        my $lastupdated = substr( LJ::mysql_time( $u->timeupdate ), 0, 10 );
-        my $secondsold = time() - $u->timeupdate;
-        my $ago_text = LJ::ago_text( $secondsold );
-        if ( $u->timeupdate ) {
-            $ret .= ", " . BML::ml( '.details.lastupdated3', 
-                { timestamp => $lastupdated, agotext => $ago_text });
-        } else {
-            $ret .= ", $ML{ '.details.lastupdated.never2' }";
-        }
+        $ret .= "<p>$jcdate (#" . $u->id . '), ' . $u->last_updated;
         $ret .= "</p>"; 
     }
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org