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

[ljcom] r9899: LJINT-362 (Comments for side projects): ...

Committer: ailyin
LJINT-362 (Comments for side projects): deleting comments
U   trunk/cgi-bin/LJ/PartnerSite.pm
U   trunk/htdocs/tools/endpoints/comments.bml
Modified: trunk/cgi-bin/LJ/PartnerSite.pm
===================================================================
--- trunk/cgi-bin/LJ/PartnerSite.pm	2011-01-13 08:13:42 UTC (rev 9898)
+++ trunk/cgi-bin/LJ/PartnerSite.pm	2011-01-13 08:25:12 UTC (rev 9899)
@@ -78,6 +78,8 @@
 sub find_entry_by_docid {
     my ( $self, $docid ) = @_;
 
+    $docid ||= '';
+
     my $memc_key = 'extarticlesmap_jitemid:' . $self->id . ':' . $docid;
 
     if ( my $jitemid = LJ::MemCache::get($memc_key) ) {
@@ -152,6 +154,8 @@
 sub article_link {
     my ( $self, $docid, $extend ) = @_;
 
+    $docid ||= '';
+
     my $link = $self->link_pattern;
     $link =~ s/\Q[[docid]]\E/$docid/g;
 

Modified: trunk/htdocs/tools/endpoints/comments.bml
===================================================================
--- trunk/htdocs/tools/endpoints/comments.bml	2011-01-13 08:13:42 UTC (rev 9898)
+++ trunk/htdocs/tools/endpoints/comments.bml	2011-01-13 08:25:12 UTC (rev 9899)
@@ -86,8 +86,7 @@
         init_comobj => 0,
     };
 
-    ## this endpoint always assumes that remote user is not logged in.
-    my $remote = undef;
+    my $remote = LJ::get_remote();
 
     ## load data
     my @comments = LJ::Talk::load_comments($journal, $remote, "L", $jitemid, $opts);
@@ -141,16 +140,32 @@
                     $data->{identity}->{url}        = $ident->url($pu);
                 }
 
-                ## resutlted array
+                $data->{'can_delete'} = LJ::Talk::can_delete( $remote,
+                                                              $journal,
+                                                              $journal,
+                                                              $pu->username );
+
+                ## resulting array
                 ($data, $self->($self, $_->{children} ) )
             } @$comments;
     };
 
+    my %vars = (
+        'journal' => $journal->username,
+        'jitemid' => $entry->jitemid,
+    );
+
+    my $auth_token = LJ::Auth->ajax_auth_token(
+        $remote, "/delcomment.bml", %vars
+    );
+
     my @result = $to_export_format->($to_export_format, \@comments);
     return $answer->({
-        'comments' => \@result,
-        'pages'    => $opts->{'out_pages'},
-        'page'     => $opts->{'out_page'},
+        'comments'      => \@result,
+        'pages'         => $opts->{'out_pages'},
+        'page'          => $opts->{'out_page'},
+        'journal'       => $journal->username,
+        'auth_token'    => $auth_token,
     });
 
 } _code?>

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