Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r22291: LJSV-2169: Custom comment pages show com...

Committer: amyshkin
LJSV-2169: Custom comment pages show comments in UTC regardless of user time zone
U   trunk/cgi-bin/LJ/S2/EntryPage.pm
Modified: trunk/cgi-bin/LJ/S2/EntryPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/EntryPage.pm	2012-06-20 11:52:32 UTC (rev 22290)
+++ trunk/cgi-bin/LJ/S2/EntryPage.pm	2012-06-20 12:24:18 UTC (rev 22291)
@@ -192,16 +192,17 @@
 
             # local time in mysql format to gmtime
             my $datetime = DateTime_unix($com->{'datepost_unix'});
-            my $datetime_remote = $tz_remote || undef;
+            my $datetime_remote = $tz_remote ? DateTime_tz($com->{'datepost_unix'}, $tz_remote) : undef;
             my $seconds_since_entry = $com->{'datepost_unix'} - $entry->logtime_unix;
-            my $datetime_poster = DateTime_tz($com->{'datepost_unix'}, $pu);
+            my $datetime_poster = DateTime_tz($com->{'datepost_unix'}, $tz_remote);
+            my ($edited, $edit_url, $edittime, $edittime_remote, $edittime_poster);
 
-            my ($edited, $edit_url, $edittime, $edittime_remote, $edittime_poster);
             if ($com->{_loaded}) {
                 my $comment = LJ::Comment->new($u, jtalkid => $com->{talkid});
 
                 $edited = $comment->is_edited;
                 $edit_url = LJ::Talk::talkargs($comment->edit_url, $style_arg);
+
                 if ($edited) {
                     $edittime = DateTime_unix($comment->edit_time);
                     $edittime_remote = $tz_remote ? DateTime_tz($comment->edit_time, $tz_remote) : undef;
@@ -269,9 +270,9 @@
                 'talkid' => $dtalkid,
                 'text' => $text,
                 'userpic' => $comment_userpic,
-                'time' => $datetime,
+                'time' => $datetime_remote,
                 'system_time' => $datetime, # same as regular time for comments
-                'edittime' => $edittime,
+                'edittime' => $edittime_remote,
                 'tags' => [],
                 'full' => $com->{'_loaded'} ? 1 : 0,
                 'show' => $com->{'_show'} ? 1 : 0,

Tags: amyshkin, livejournal, pm, zilogic
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