Committer: sbelyaev
LJSUP-11909: New Repost featureU trunk/cgi-bin/ljprotocol.pl U trunk/htdocs/editjournal.bml
Modified: trunk/cgi-bin/ljprotocol.pl =================================================================== --- trunk/cgi-bin/ljprotocol.pl 2012-05-12 09:43:18 UTC (rev 21931) +++ trunk/cgi-bin/ljprotocol.pl 2012-05-12 09:52:04 UTC (rev 21932) @@ -2427,6 +2427,7 @@ my $res = {}; my $res_done = 0; # set true by getlock when post was duplicate, or error getting lock + my $allowdup = $flags->{'allow_dupsing_post'}; my $getlock = sub { my $delayed = @_; my $r = $dbcm->selectrow_array("SELECT GET_LOCK(?, 2)", undef, $lock_key); @@ -2440,7 +2441,7 @@ LJ::load_user_props($u, { use_master => 1, reload => 1 }, 'dupsig_post'); my @parts = split(/:/, $u->{'dupsig_post'}); - if ($parts[0] eq $dupsig) { + if ($parts[0] eq $dupsigi && !$allowdup) { # duplicate! let's make the client think this was just the # normal firsit response. Modified: trunk/htdocs/editjournal.bml =================================================================== --- trunk/htdocs/editjournal.bml 2012-05-12 09:43:18 UTC (rev 21931) +++ trunk/htdocs/editjournal.bml 2012-05-12 09:52:04 UTC (rev 21932) @@ -126,7 +126,7 @@ }; } }; - + if ( scalar @$items == 0 ) { $insert->(); return @ordered; @@ -171,12 +171,25 @@ } my @entries; + my $real_entries = {}; my $journal = LJ::load_user($usejournal) || $remote; foreach my $e_raw (@res) { if ( $e_raw->{'itemid'} ) { - push @entries, - LJ::Entry->new_from_item_hash( $journal, $e_raw ); + my $entry_obj + = LJ::Entry->new_from_item_hash( $journal, $e_raw ); + + my $repost_entry_obj; + my $content = { 'original_post_obj' => \$entry_obj, + 'repost_obj' => \$repost_entry_obj, }; + + if (LJ::EntryReference->substitute_content( $entry_obj, $content )) { + $real_entries->{$entry_obj->posterid}->{$entry_obj->jitemid} + = { 'itemid' => $repost_entry_obj->jitemid, + 'journalid' => $repost_entry_obj->journalid, }; + } + + push @entries, $entry_obj; } } @@ -191,6 +204,7 @@ 'link_next' => $link_next, 'show_posters' => $usejournal ? 1 : 0, 'entries' => \@entries, + 'real_entries' => $real_entries, 'adhtml' => $adhtml, ); }; @@ -237,9 +251,9 @@ $itemid = int($ditemid / 256); $entry_obj = LJ::Entry->new($u_for_entry, ditemid => $ditemid); - + # do getevents request - + LJ::do_request({ 'mode' => 'getevents', 'selecttype' => 'one', 'ver' => $LJ::PROTOCOL_VER,