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

[livejournal] r17545: LJSUP-7105. made code more readable

Committer: gprochaev
LJSUP-7105. made code more readable

U   trunk/cgi-bin/LJ/Event/JournalNewComment.pm
Modified: trunk/cgi-bin/LJ/Event/JournalNewComment.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2010-10-12 03:40:12 UTC (rev 17544)
+++ trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2010-10-12 03:51:42 UTC (rev 17545)
@@ -225,49 +225,51 @@
 
     my $msg;
 
-    my $lang = $self->comment->parent && $self->comment->parent->poster
-               ? $self->comment->parent->poster->prop('browselang')
+    my $parent = $self->comment->parent;
+    my $entry = $self->comment->entry;
+    my $lang = $parent && $parent->poster
+               ? $parent->poster->prop('browselang')
                : $LJ::DEFAULT_LANG;
     if ($self->event_journal->journaltype eq 'C') {
-        if ($self->comment->parent) {
+        if ($parent) {
             if ($edited) {
-                $msg = LJ::u_equals($self->comment->parent->poster, $u)
+                $msg = LJ::u_equals($parent->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.communityentryreply.edit_reply_your_comment', undef, { user => $user, community => $self->event_journal->user } )
                         : LJ::Lang::get_text($lang, 'sms.communityentryreply.edit_reply_a_comment', undef, { user => $user, community => $self->event_journal->user } );
             } else {
-                $msg = LJ::u_equals($self->comment->parent->poster, $u)
+                $msg = LJ::u_equals($parent->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.communityentryreply.replied_your_comment', undef, { user => $user, community => $self->event_journal->user } )
                         : LJ::Lang::get_text($lang, 'sms.communityentryreply.replied_a_comment', undef, { user => $user, community => $self->event_journal->user } );
             }
         } else {
             if ($edited) {
-                $msg = LJ::u_equals($self->comment->entry->poster, $u)
+                $msg = LJ::u_equals($entry->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.communityentryreply.edit_reply_your_post', undef, { user => $user, community => $self->event_journal->user } )
                         : LJ::Lang::get_text($lang, 'sms.communityentryreply.edit_reply_a_post', undef, { user => $user, community => $self->event_journal->user } );
             } else {
-                $msg = LJ::u_equals($self->comment->entry->poster, $u)
+                $msg = LJ::u_equals($entry->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.communityentryreply.replied_your_post', undef, { user => $user, community => $self->event_journal->user } )
                         : LJ::Lang::get_text($lang, 'sms.communityentryreply.replied_a_post', undef, { user => $user, community => $self->event_journal->user } );
             }
         }
     } else {
-        if ($self->comment->parent) {
+        if ($parent) {
             if ($edited) {
-                $msg = LJ::u_equals($self->comment->parent->poster, $u)
+                $msg = LJ::u_equals($parent->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.journalnewcomment.edit_reply_your_comment', undef, { user => $user } )
                         : LJ::Lang::get_text($lang, 'sms.journalnewcomment.edit_reply_a_comment', undef, { user => $user } );
             } else {
-                $msg = LJ::u_equals($self->comment->parent->poster, $u)
+                $msg = LJ::u_equals($parent->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.journalnewcomment.replied_your_comment', undef, { user => $user } )
                         : LJ::Lang::get_text($lang, 'sms.journalnewcomment.replied_a_comment', undef, { user => $user } );
             }
         } else {
             if ($edited) {
-                $msg = LJ::u_equals($self->comment->entry->poster, $u)
+                $msg = LJ::u_equals($entry->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.journalnewcomment.edit_reply_your_post', undef, { user => $user } )
                         : LJ::Lang::get_text($lang, 'sms.journalnewcomment.edit_reply_a_post', undef, { user => $user } );
             } else {
-                $msg = LJ::u_equals($self->comment->entry->poster, $u)
+                $msg = LJ::u_equals($entry->poster, $u)
                         ? LJ::Lang::get_text($lang, 'sms.journalnewcomment.replied_your_post', undef, { user => $user } )
                         : LJ::Lang::get_text($lang, 'sms.journalnewcomment.replied_a_post', undef, { user => $user } );
             }
@@ -276,7 +278,7 @@
 
     warn $self->comment->url;
     #/read/user/%username%/%post_ID%/comments/%comment_ID%#comments
-    my $url = "http://m.livejournal.com/read/user/".$self->event_journal->user."/".$self->comment->entry->ditemid."/comments/".$self->comment->dtalkid."#comments";
+    my $url = "http://m.livejournal.com/read/user/".$self->event_journal->user."/".$entry->ditemid."/comments/".$self->comment->dtalkid."#comments";
     warn $url;
     my $tinyurl = LJ::API::BitLy->shorten($url);
     return undef if $tinyurl =~ /^500/;

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