[livejournal] r19216: LJSUP-8980 (Ability to repost LJ-like)
Committer: ailyin
LJSUP-8980 (Ability to repost LJ-like)U trunk/bin/upgrading/proplists.dat U trunk/cgi-bin/LJ/Entry.pm U trunk/cgi-bin/LJ/S2/DayPage.pm U trunk/cgi-bin/LJ/S2/FriendsPage.pm U trunk/cgi-bin/LJ/S2/RecentPage.pm U trunk/cgi-bin/LJ/S2.pm U trunk/cgi-bin/ljviews.pl U trunk/cgi-bin/weblib.pl U trunk/htdocs/talkpost.bml U trunk/htdocs/talkread.bml U trunk/htdocs/update.bml
Modified: trunk/bin/upgrading/proplists.dat
===================================================================
--- trunk/bin/upgrading/proplists.dat 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/bin/upgrading/proplists.dat 2011-06-03 07:03:14 UTC (rev 19216)
@@ -1658,3 +1658,7 @@
multihomed: 0
prettyname: Friendspage filtrating tags
+logproplist.reposted_from:
+ datatype: char
+ prettyname: Reposted from
+ des: In case this entry is a repost, the URL of the original entry that was reposted
Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/LJ/Entry.pm 2011-06-03 07:03:14 UTC (rev 19216)
@@ -830,14 +830,14 @@
if($opts->{no_cut_expand}) {
$opts->{expand_cut} = 0;
- $opts->{cuturl} = $self->url . '?page=' . $opts->{page} . '&cut_expand=1';
+ $opts->{cuturl} = $self->prop('reposted_from') || $self->url . '?page=' . $opts->{page} . '&cut_expand=1';
} elsif (!$opts->{cuturl}) {
$opts->{expand_cut} = 1;
- $opts->{cuturl} = $self->url;
+ $opts->{cuturl} = $self->prop('reposted_from') || $self->url;
}
$opts->{journalid} = $self->journalid;
$opts->{posterid} = $self->posterid;
- $opts->{entry_url} = $self->url;
+ $opts->{entry_url} = $self->prop('reposted_from') || $self->url;
$self->_load_text unless $self->{_loaded_text};
my $event = $self->{event};
Modified: trunk/cgi-bin/LJ/S2/DayPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/DayPage.pm 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/LJ/S2/DayPage.pm 2011-06-03 07:03:14 UTC (rev 19216)
@@ -155,8 +155,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$text, { 'preformatted' => $logprops{$itemid}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url,
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url,
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'ljcut_disable' => $remote ? $remote->{'opt_ljcut_disable_lastn'} : undef,
'suspend_msg' => $suspend_msg,
'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0,
Modified: trunk/cgi-bin/LJ/S2/FriendsPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/FriendsPage.pm 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/LJ/S2/FriendsPage.pm 2011-06-03 07:03:14 UTC (rev 19216)
@@ -260,8 +260,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$text, { 'preformatted' => $logprops{$datakey}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url(%urlopts),
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url(%urlopts),
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'maximgwidth' => $maximgwidth,
'maximgheight' => $maximgheight,
'ljcut_disable' => $remote ? $remote->{'opt_ljcut_disable_friends'} : undef,
Modified: trunk/cgi-bin/LJ/S2/RecentPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/RecentPage.pm 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/LJ/S2/RecentPage.pm 2011-06-03 07:03:14 UTC (rev 19216)
@@ -188,8 +188,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$text, { 'preformatted' => $logprops{$itemid}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url,
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url,
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'ljcut_disable' => ($remote) ? $remote->prop("opt_ljcut_disable_lastn") : undef,
'suspend_msg' => $suspend_msg,
'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0,
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/LJ/S2.pm 2011-06-03 07:03:14 UTC (rev 19216)
@@ -4423,8 +4423,8 @@
my $text = $entry->event_raw;
LJ::CleanHTML::clean_event( \$text, {
'preformatted' => $entry->prop('opt_preformatted'),
- 'cuturl' => $entry->url,
- 'entry_url' => $entry->url,
+ 'cuturl' => $entry->prop('reposted_from') || $entry->url,
+ 'entry_url' => $entry->prop('reposted_from') || $entry->url,
'ljcut_disable' => 0,
'journalid' => $entry->journalid,
'posterid' => $entry->posterid,
Modified: trunk/cgi-bin/ljviews.pl
===================================================================
--- trunk/cgi-bin/ljviews.pl 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/ljviews.pl 2011-06-03 07:03:14 UTC (rev 19216)
@@ -1334,8 +1334,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$event, { 'preformatted' => $logprops{$itemid}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url,
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url,
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'ljcut_disable' => ($remote) ? $remote->{'opt_ljcut_disable_lastn'} : undef,
'suspend_msg' => $suspend_msg,
'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0,
@@ -1876,8 +1876,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$event, { 'preformatted' => $logprops{$datakey}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url(%urlopts),
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url(%urlopts),
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'maximgwidth' => $maximgwidth,
'maximgheight' => $maximgheight,
'ljcut_disable' => ($remote) ? $remote->{'opt_ljcut_disable_friends'} : undef,
@@ -2604,8 +2604,8 @@
my $suspend_msg = $entry_obj && $entry_obj->should_show_suspend_msg_to($remote) ? 1 : 0;
LJ::CleanHTML::clean_event(\$event, { 'preformatted' => $logprops{$itemid}->{'opt_preformatted'},
- 'cuturl' => $entry_obj->url,
- 'entry_url' => $entry_obj->url,
+ 'cuturl' => $entry_obj->prop('reposted_from') || $entry_obj->url,
+ 'entry_url' => $entry_obj->prop('reposted_from') || $entry_obj->url,
'ljcut_disable' => ($remote) ? $remote->{'opt_ljcut_disable_lastn'} : undef,
'suspend_msg' => $suspend_msg,
'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0,
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/cgi-bin/weblib.pl 2011-06-03 07:03:14 UTC (rev 19216)
@@ -1138,6 +1138,15 @@
$req->{'prop_copyright'} = $POST->{'prop_copyright'} ? 'P' : 'C' if LJ::is_enabled('default_copyright', LJ::get_remote())
&& $POST->{'defined_copyright'};
+ if ( my $reposted_from = $POST->{'reposted_from'} ) {
+ my $reposted_entry = LJ::Entry->new_from_url($reposted_from);
+
+ #TODO: check visibility? it's not a security concern, but still
+ if ($reposted_entry) {
+ $req->{'prop_reposted_from'} = $reposted_entry->url;
+ }
+ }
+
if (LJ::is_enabled("content_flag")) {
$req->{prop_adult_content} = $POST->{prop_adult_content};
$req->{prop_adult_content} = ""
Modified: trunk/htdocs/talkpost.bml
===================================================================
--- trunk/htdocs/talkpost.bml 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/htdocs/talkpost.bml 2011-06-03 07:03:14 UTC (rev 19216)
@@ -204,8 +204,8 @@
LJ::CleanHTML::clean_event(\$event, { 'preformatted' => $preformatted,
'suspend_msg' => $suspend_msg,
'unsuspend_supportid' => $suspend_msg ? $entry->prop("unsuspend_supportid") : 0,
- 'cuturl' => $talkurl,
- 'entry_url' => $talkurl,
+ 'cuturl' => $entry->prop('reposted_from') || $talkurl,
+ 'entry_url' => $entry->prop('reposted_from') || $talkurl,
'expand_cut' => 1,
'journalid' => $entry->journalid,
'posterid' => $entry->posterid,
Modified: trunk/htdocs/talkread.bml
===================================================================
--- trunk/htdocs/talkread.bml 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/htdocs/talkread.bml 2011-06-03 07:03:14 UTC (rev 19216)
@@ -273,7 +273,7 @@
preformatted => $props->{'opt_preformatted'},
suspend_msg => $suspend_msg,
unsuspend_supportid => $suspend_msg ? $entry->prop("unsuspend_supportid") : 0,
- cuturl => $talkurl,
+ cuturl => $entry->prop('reposted_from') || $talkurl,
expand_cut => !$no_cut_expand,
journalid => $entry->journalid,
posterid => $entry->posterid,
Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml 2011-06-03 03:25:38 UTC (rev 19215)
+++ trunk/htdocs/update.bml 2011-06-03 07:03:14 UTC (rev 19216)
@@ -156,7 +156,9 @@
EMBED
}
}
-
+
+ my $reposted_from = '';
+
# in case of repost other entry by its uri we should check its visibility
# for remote user.
if (my $repost = ($POST{repost} || $GET{repost})){
@@ -170,18 +172,13 @@
$subject ||= (LJ::ehtml($entry->subject_orig) || LJ::Lang::ml("repost.default_subject"));
unless ($event){
$event = $entry->event_raw;
- LJ::CleanHTML::clean_event( \$event, {
- 'cuturl' => $entry->url,
- 'entry_url' => $entry->url,
- 'journalid' => $entry->journalid,
- 'posterid' => $entry->posterid,
- } );
$event = LJ::Lang::ml("repost.wrapper", {
username => $entry->poster->username,
url => $entry->url,
subject => $subject,
text => $event,
});
+ $reposted_from = $entry->url;
}
}
@@ -338,6 +335,10 @@
$$body .= "\n\n<form method='post' action='update.bml$getextra' id='updateForm' name='updateForm'>\n\n";
$$body .= LJ::form_auth();
+ if ($reposted_from) {
+ $$body .= LJ::html_hidden( 'reposted_from' => $reposted_from );
+ }
+
if ($opts->{require_tos}){
$$body .= LJ::tosagree_html('update', $POST{agree_tos}, $errors->{require_tos});
}
