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

[livejournal] r18800: LJSUP-8486. Usernames of identity accoun...

Committer: gprochaev
LJSUP-8486. Usernames of identity accounts does not cut

U   trunk/cgi-bin/LJ/Event/Birthday.pm
U   trunk/cgi-bin/LJ/Event/CommentReply.pm
U   trunk/cgi-bin/LJ/Event/CommunityInvite.pm
U   trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm
U   trunk/cgi-bin/LJ/Event/JournalNewComment.pm
U   trunk/cgi-bin/LJ/Event/NewUserpic.pm
U   trunk/cgi-bin/LJ/Event/OfficialPost.pm
U   trunk/cgi-bin/LJ/Event/PollVote.pm
U   trunk/cgi-bin/LJ/Event/UserExpunged.pm
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/Event/Birthday.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/Birthday.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/Birthday.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -45,7 +45,7 @@
 
 # [[user]]'s birthday is on [[bday]]!
     return LJ::Lang::get_text($lang, 'notification.sms.birthday', undef, {
-        user       => $self->bdayuser->display_username,
+        user       => $self->bdayuser->display_username(1),
         bday       => $self->bday,
         mobile_url => $tinyurl,
     });

Modified: trunk/cgi-bin/LJ/Event/CommentReply.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/CommentReply.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/CommentReply.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -17,7 +17,7 @@
 sub as_sms {
     my ($self, $u, $opt) = @_;
 
-    my $user = $self->comment->poster ? $self->comment->poster->display_username : '(Anonymous user)';
+    my $user = $self->comment->poster ? $self->comment->poster->display_username(1) : '(Anonymous user)';
     my $edited = $self->comment->is_edited;
 
     my $lang = $u->prop('browselang') || $LJ::DEFAULT_LANG;

Modified: trunk/cgi-bin/LJ/Event/CommunityInvite.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/CommunityInvite.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/CommunityInvite.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -132,8 +132,8 @@
 
 # [[inviter]] sent you an invitation to join the community [[comm]]. Visit the invitation page to accept
     return LJ::Lang::get_text($lang, 'notification.sms.communityinvite', undef, {
-        inviter => $self->inviter->display_username,
-        comm    => $self->comm->display_username,
+        inviter => $self->inviter->display_username(1),
+        comm    => $self->comm->display_username(1),
     });
 
 #    return sprintf("%s sent you an invitation to join the community %s. Visit the invitation page to accept",

Modified: trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -140,8 +140,8 @@
 
 # [[requestor]] requests membership in [[comm]]. Visit community settings to approve.
     return LJ::Lang::get_text($lang, 'notification.sms.communityjoinrequest', undef, {
-        requestor => $self->requestor->display_username,
-        comm      => $self->comm->display_username,
+        requestor => $self->requestor->display_username(1),
+        comm      => $self->comm->display_username(1),
     });
 }
 

Modified: trunk/cgi-bin/LJ/Event/JournalNewComment.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -220,7 +220,7 @@
 sub as_sms {
     my ($self, $u, $opt) = @_;
 
-    my $user = $self->comment->poster ? $self->comment->poster->display_username : '(Anonymous user)';
+    my $user = $self->comment->poster ? $self->comment->poster->display_username(1) : '(Anonymous user)';
     my $edited = $self->comment->is_edited;
 
     my $parent = $self->comment->parent;

Modified: trunk/cgi-bin/LJ/Event/NewUserpic.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/NewUserpic.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/NewUserpic.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -31,7 +31,7 @@
 
 # [[journal]] has uploaded a new userpic. You can view it at: [[pic_url]]
     return LJ::Lang::get_text($lang, 'notification.sms.newuserpic', undef, {
-        journal => $self->event_journal->display_username,
+        journal => $self->event_journal->display_username(1),
         pic_url => $self->userpic->url,
     });
 }

Modified: trunk/cgi-bin/LJ/Event/OfficialPost.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/OfficialPost.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/OfficialPost.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -139,7 +139,7 @@
 # There is a new [[abbrev]] announcement in [[journal]]. Reply with READ [[journal]] to read it. [[disclaimer]]
     return LJ::Lang::get_text($lang, 'notification.sms.officialpost', undef, {
         abbrev     => $LJ::SITENAMEABBREV,
-        journal    => $entry->journal->display_username,
+        journal    => $entry->journal->display_username(1),
         disclaimer => $LJ::SMS_DISCLAIMER,
         mobile_url => $tinyurl,
     });    

Modified: trunk/cgi-bin/LJ/Event/PollVote.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/PollVote.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/PollVote.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -59,7 +59,7 @@
 
 # [[voter]] has voted in [[pollname]] at [[entry_url]]
     return LJ::Lang::get_text($lang, 'notification.sms.pollvote', undef, {
-        voter     => $self->voter->display_username, 
+        voter     => $self->voter->display_username(1), 
         pollname  => $self->pollname, 
         entry_url => $self->entry->url
     });    

Modified: trunk/cgi-bin/LJ/Event/UserExpunged.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/UserExpunged.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/Event/UserExpunged.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -16,7 +16,7 @@
 
 # [[journal]] has been purged.
     return LJ::Lang::get_text($lang, 'notification.sms.userexpunged', undef, {
-        journal => $self->event_journal->display_username,
+        journal => $self->event_journal->display_username(1),
     });    
 }
 

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-04-06 03:28:13 UTC (rev 18799)
+++ trunk/cgi-bin/LJ/User.pm	2011-04-06 04:01:55 UTC (rev 18800)
@@ -3837,6 +3837,17 @@
 # returns username for display
 sub display_username {
     my $u = shift;
+    my $need_cut = shift || 0;
+
+    if ($u->is_identity && $need_cut) {
+        my $name = $u->display_name;
+        my $short_name = substr ($name, 0, 16);
+        if ($name ne $short_name) {
+            $short_name .= "...";
+        }
+        return $short_name;
+    }
+
     return $u->display_name if $u->is_identity;
     return $u->{user};
 }

Tags: 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