Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r17870: LJINT-362 (comments for side projects)

Committer: ailyin
LJINT-362 (comments for side projects)
U   trunk/cgi-bin/LJ/Identity.pm
U   trunk/htdocs/gadgets/logcom.bml
Modified: trunk/cgi-bin/LJ/Identity.pm
===================================================================
--- trunk/cgi-bin/LJ/Identity.pm	2010-12-07 07:49:30 UTC (rev 17869)
+++ trunk/cgi-bin/LJ/Identity.pm	2010-12-07 08:38:32 UTC (rev 17870)
@@ -38,6 +38,7 @@
 use strict;
 
 use Carp qw();
+use URI qw();
 
 # initialization code. do not touch this.
 my @CLASSES = LJ::ModuleLoader->module_subclasses('LJ::Identity');
@@ -208,12 +209,18 @@
                   "jid=$journalid&" .
                   "pendcid=$pendcid";
         $returl_fail = $returl . '&failed=1';
-    } elsif ($forwhat =~ /^external-(\d+)-(\d+)$/) {
-        my ($journalid, $jitemid) = ($1, $2);
+    } elsif ($forwhat =~ /^external-/) {
+        my (undef, $journalid, $ditemid, $dtalkid) = split /-/, $forwhat;
         my $journal = LJ::load_userid($journalid);
-        my $entry = LJ::Entry->new($journal, 'jitemid' => $jitemid);
+        my $entry = LJ::Entry->new($journal, 'ditemid' => $ditemid);
 
-        $returl = $returl_fail = $entry->prop('external_url');
+        my $uri = URI->new( $entry->prop('external_url') );
+        if ($dtalkid) {
+            $uri->query_form( $uri->query_form, 'replyto' => $dtalkid );
+            $uri->fragment( 't' . $dtalkid );
+        }
+
+        $returl = $returl_fail = $uri->as_string;
     } else {
         # the warning will sit in error logs, and the exception
         # will be handled

Modified: trunk/htdocs/gadgets/logcom.bml
===================================================================
--- trunk/htdocs/gadgets/logcom.bml	2010-12-07 07:49:30 UTC (rev 17869)
+++ trunk/htdocs/gadgets/logcom.bml	2010-12-07 08:38:32 UTC (rev 17870)
@@ -31,20 +31,20 @@
         return "Can't create new entry" unless $jitemid;
     }
 
+    my $replyto = LJ::Request->get_param('replyto');
+    
+    if ($replyto) {
+        my $parent  = LJ::Comment->new( $journal, 'dtalkid' => $replyto );
+        $replyto    = 0
+            unless $parent->valid;
+    }
+
+    my $entry = LJ::Entry->new($journal, jitemid => $jitemid);
+
     if (my $remote = LJ::get_remote() and not $GET{viewform}){
         ## show add comment form
         LJ::need_res(qw( stc/partners/login.css ));
 
-        my $replyto = LJ::Request->get_param('replyto');
-        
-        if ($replyto) {
-            my $parent  = LJ::Comment->new( $journal, 'dtalkid' => $replyto );
-            $replyto    = 0
-                unless $parent->valid;
-        }
-
-        my $entry = LJ::Entry->new($journal, jitemid => $jitemid);
-
         my $remote_sessid;
         if ($remote) {
             $remote_sessid = $remote->session->id;
@@ -72,8 +72,17 @@
           stc/partners/login.css
         ));
 
-        my $forwhat = 'external-' . $journal->userid . '-' . $jitemid;
+        my $forwhat = 'external-' .
+                      $journal->userid . '-' .
+                      $entry->ditemid . '-' .
+                      $replyto;
 
+        my $uri = URI->new($url);
+        if ($replyto) {
+            $uri->query_form( $uri->query_form, 'replyto' => $replyto );
+            $uri->fragment( 't' . $replyto );
+        }
+
         my $ret = "";
         $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
         <html>
@@ -82,7 +91,7 @@
         <title>Log in</title>
         " . LJ::res_includes() . "
         <body>"
-        . LJ::Widget::LoginMulti->render(thispage => $url, forwhat => $forwhat, lj_auth => 1,)
+        . LJ::Widget::LoginMulti->render(thispage => $uri->as_string, forwhat => $forwhat, lj_auth => 1,)
         ."</body></html>";
         return $ret;
     }

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