Committer: sbelyaev
LJSUP-10119: Changes is reverted, sticky entry property renamed from sticky_entry to sticky_entry_idU trunk/bin/upgrading/proplists.dat U trunk/cgi-bin/LJ/User.pm U trunk/cgi-bin/ljprotocol.pl
Modified: trunk/bin/upgrading/proplists.dat =================================================================== --- trunk/bin/upgrading/proplists.dat 2011-10-18 09:00:38 UTC (rev 20352) +++ trunk/bin/upgrading/proplists.dat 2011-10-18 09:00:52 UTC (rev 20353) @@ -1748,10 +1748,10 @@ multihomed: 0 cldversion: 8 -userproplist.sticky_entry: +userproplist.sticky_entry_id: datatype: char - des: Sticky entry + des: Sticky entry id indexed: 0 - prettyname: Sticky entry + prettyname: Sticky entry id Modified: trunk/cgi-bin/LJ/User.pm =================================================================== --- trunk/cgi-bin/LJ/User.pm 2011-10-18 09:00:38 UTC (rev 20352) +++ trunk/cgi-bin/LJ/User.pm 2011-10-18 09:00:52 UTC (rev 20353) @@ -6256,6 +6256,8 @@ # returns sticky entry jitemid sub remove_sticky_id { my ($self) = @_; + my $ownerid = $self->userid; + LJ::MemCache::delete([$ownerid, "log2lt:$ownerid"]); $self->clear_prop("sticky_entry_id"); } @@ -6263,6 +6265,9 @@ sub set_sticky_id { my ($self, $itemid) = @_; die "itemid is not set" unless ($itemid); + + my $ownerid = $self->userid; + LJ::MemCache::delete([$ownerid, "log2lt:$ownerid"]); $self->set_prop( sticky_entry_id => $itemid ); } Modified: trunk/cgi-bin/ljprotocol.pl =================================================================== --- trunk/cgi-bin/ljprotocol.pl 2011-10-18 09:00:38 UTC (rev 20352) +++ trunk/cgi-bin/ljprotocol.pl 2011-10-18 09:00:52 UTC (rev 20353) @@ -1852,7 +1852,6 @@ sub postevent { my ($req, $err, $flags) = @_; - un_utf8_request($req); my $post_noauth = LJ::run_hook('post_noauth', $req); @@ -1998,7 +1997,7 @@ # return fail($err, 153, "You have an entry which was posted at $u->{'newesteventtime'}, but you're trying to post an entry before this. Please check the date and time of both entries. If the other entry is set in the future on purpose, edit that entry to use the \"Date Out of Order\" option. Otherwise, use the \"Date Out of Order\" option for this entry instead."); #} - if ( $req->{type} eq 'sticky' && + if ( $req->{sticky} && $uowner->{'journaltype'} eq 'C' && !( LJ::check_rel($ownerid, $posterid, 'S') || LJ::check_rel($ownerid, $posterid, 'M') ) ) @@ -2314,7 +2313,7 @@ "UNIX_TIMESTAMP($qeventtime), $rlogtime, $anum)"); return $fail->($err,501,$dberr) if $dberr; - if ( $req->{type} eq 'sticky' && + if ( $req->{sticky} && $uowner->{'journaltype'} eq 'C' && !( LJ::check_rel($ownerid, $posterid, 'S') || LJ::check_rel($ownerid, $posterid, 'M') ) ) @@ -2323,7 +2322,7 @@ } # post become 'sticky post' - if ( $req->{type} eq 'sticky' ) { + if ( $req->{sticky} ) { $uowner->set_sticky($jitemid); } @@ -2795,8 +2794,8 @@ } }; - if ( $itemid == $uowner->get_sticky_entry() ) { - $uowner->remove_sticky(); + if ( $itemid == $uowner->get_sticky_entry_id() ) { + $uowner->remove_sticky_id(); } return $res; @@ -2826,15 +2825,13 @@ LJ::load_log_props2($dbcm, $ownerid, [ $itemid ], \%curprops); # make post sticky - if ( $req->{type} eq 'sticky' ) { - if( $uowner->get_sticky_entry() != $itemid ) { - $uowner->set_sticky($itemid); - LJ::MemCache::delete([$ownerid, "log2lt:$ownerid"]); + if ( $req->{sticky} ) { + if( $uowner->get_sticky_entry_id() != $itemid ) { + $uowner->set_sticky_id($itemid); } } - elsif ( $itemid == $uowner->get_sticky_entry() ) { - $uowner->remove_sticky(); - LJ::MemCache::delete([$ownerid, "log2lt:$ownerid"]); + elsif ( $itemid == $uowner->get_sticky_entry_id() ) { + $uowner->remove_sticky_id(); } ## give features @@ -3081,7 +3078,7 @@ $uowner = LJ::load_userid( $req->{journalid} ); } - my $sticky_id = $uowner->prop("sticky_entries") || undef; + my $sticky_id = $uowner->prop("sticky_entry_id") || undef; my $dbr = LJ::get_db_reader(); my $sth;