Make AJAX tracker on reading page aware of which journal is being 
tracked.

        Patch by wyntarvox. 

diffs (43 lines):

diff -r fbc88a77756e -r 8b4cb56c5ca9 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm  Tue Oct 27 15:43:01 2009 -0500
+++ b/cgi-bin/LJ/S2.pm  Tue Oct 27 22:27:40 2009 -0500
@@ -3542,6 +3542,7 @@ sub _Entry__get_link
     my $remote = LJ::get_remote();
     my $null_link = { '_type' => 'Link', '_isnull' => 1 };
     my $journalu = LJ::load_user($journal);
+    my $esnjournal = $journalu->is_community ? $journal : $poster;
 
     if ($key eq "edit_entry") {
         return $null_link unless $remote && ($remote->{'user'} eq $journal ||
@@ -3636,7 +3637,8 @@ sub _Entry__get_link
                             'lj_newentry_token'   => $newentry_auth_token,
                             'lj_newentry_subid'   => $newentry_sub ? 
$newentry_sub->id : 0,
                             'class'               => 'TrackButton',
-                            'js_swapname'         => 
$ctx->[S2::PROPS]->{text_unwatch_comments} );
+                            'js_swapname'         => 
$ctx->[S2::PROPS]->{text_unwatch_comments},
+                            'journal'              => $esnjournal );
     }
     if ($key eq "unwatch_comments") {
         return $null_link unless LJ::is_enabled('esn');
@@ -3667,7 +3669,8 @@ sub _Entry__get_link
                             'lj_newentry_token'   => $newentry_auth_token,
                             'lj_newentry_subid'   => $newentry_sub ? 
$newentry_sub->id : 0,
                             'class'               => 'TrackButton',
-                            'js_swapname'         => 
$ctx->[S2::PROPS]->{text_watch_comments} );
+                            'js_swapname'         => 
$ctx->[S2::PROPS]->{text_watch_comments},
+                            'journal'             => $esnjournal );
     }
 }
 
diff -r fbc88a77756e -r 8b4cb56c5ca9 htdocs/js/esn.js
--- a/htdocs/js/esn.js  Tue Oct 27 15:43:01 2009 -0500
+++ b/htdocs/js/esn.js  Tue Oct 27 22:27:40 2009 -0500
@@ -156,6 +156,8 @@ ESN.trackBtnClickHandler = function (evt
         
         if ( typeof LJ_cmtinfo !== 'undefined' ) {
             journal = LJ_cmtinfo["journal"];
+        } else if ( typeof trackBtn.getAttribute( "journal" ) != "undefined" ) 
{
+            journal = trackBtn.getAttribute( "journal" );
         } else if ( typeof Site !== 'undefined' ) {
             journal = Site.currentJournal;
         }
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to