madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20238: LJSUP-10037: fixed problem with error af...

Committer: sbelyaev
LJSUP-10037: fixed problem with error after post
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-06 07:16:03 UTC (rev 20237)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-06 10:16:46 UTC (rev 20238)
@@ -687,10 +687,6 @@
         $sql_poster = 'AND posterid = ' . $user->userid . " "; 
     }
 
-    #my $secwhere = __delayed_entry_can_see() __delayed_entry_secwhere( $journal,
-    #                                         $journal->userid,
-    #                                         $userid );
-
     my $tz = $user->prop("timezone");
     my $daterequest;
     if ($tz) {
@@ -795,10 +791,6 @@
                                                       $u );
     }
 
-    #my $secwhere = __delayed_entry_secwhere( $journal,
-    #                                         $journal->userid,
-    #                                         $userid );
-
     return $dbcr->selectrow_array(" SELECT count(delayedid) " .
                                     "FROM delayedlog2 ".
                                     "WHERE journalid=$journalid ");
@@ -850,11 +842,13 @@
 
     my $remote = LJ::get_remote();
     return undef unless $remote;
-    return undef unless __delayed_entry_can_see( $journal,
-                                                 $remote  );
-    
+    my $sql_poster = '';
+    if (! __delayed_entry_can_see( $journal, $remote ) ) {
+        $sql_poster = 'AND posterid = ' . $remote->userid . " ";
+    }
+
     my $sth = $dbcr->prepare("SELECT year, month, day, COUNT(*) " .
-                             "FROM delayedlog2 WHERE journalid=? $secwhere GROUP BY 1, 2, 3");
+                             "FROM delayedlog2 WHERE journalid=? $sql_poster $secwhere GROUP BY 1, 2, 3");
     $sth->execute($journal->userid);
     while (my ($y, $m, $d, $c) = $sth->fetchrow_array) {
         push @$list, [ int($y), int($m), int($d), int($c) ];
@@ -1264,14 +1258,13 @@
                                 "VALUES ($journalid, $jitemid, $posterid, $qeventtime, FROM_UNIXTIME($now), $qsecurity, $qallowmask, ".
                                 "0, $req->{'year'}, $req->{'mon'}, $req->{'day'}, $LJ::EndOfTime-".
                                 "UNIX_TIMESTAMP($qeventtime), $rlogtime, $anum)");
-
     return {
         error_message => $dberr,
         delete_entry  => 0,
     } if $dberr;
 
     # post become 'sticky post'
-    if ( $req->{type} && $req->{type} eq 'sticky' ) {
+    if ( $req->{sticky}  ) {
         $journal->set_sticky($jitemid);
     }
 
@@ -1296,7 +1289,6 @@
     $release->();
 
     my $ditemid = $jitemid * 256 + $anum;
-
     ### finish embedding stuff now that we have the itemid
     {
         ### this should NOT return an error, and we're mildly fucked by now

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-10-06 07:16:03 UTC (rev 20237)
+++ trunk/cgi-bin/LJ/User.pm	2011-10-06 10:16:46 UTC (rev 20238)
@@ -7871,14 +7871,7 @@
     LJ::MemCache::set($memkey, [time, @days]);
 
     # not cached part
-    $sth = LJ::DelayedEntry->get_daycount_query($u, $secwhere);
-    if ($sth) {
-        while (my ($y, $m, $d, $c) = $sth->fetchrow_array) {
-            # we force each number from string scalars (from DBI) to int scalars,
-            # so they store smaller in memcache
-            push @days, [ int($y), int($m), int($d), int($c) ];
-        }
-    }
+    LJ::DelayedEntry->get_daycount_query($u, \@days, $secwhere);
     $release_lock->();
     return \@days;
 }

Tags: livejournal, madeon, pm, sbelyaev
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