madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21972: LJSUP-12214: There is delayed entry on m...

Committer: sbelyaev
LJSUP-12214: There is delayed entry on manage/scheduled_posts.bml after entry go to live
U   trunk/cgi-bin/LJ/DelayedEntry.pm
Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2012-05-16 07:55:13 UTC (rev 21971)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2012-05-16 09:12:55 UTC (rev 21972)
@@ -702,6 +702,10 @@
         $sql_poster = 'AND posterid = ' . $user->userid . " ";
     }
 
+    unless ($options->{'show_posted'}) {
+        $sql_poster = " AND finaltime IS NULL ";
+    }
+
     my $dbcr = LJ::get_cluster_master($journal)
         or die "get cluster for journal failed";
 
@@ -798,6 +802,7 @@
 
     my ($delayeds) =  $dbcr->selectcol_arrayref("SELECT delayedid " .
                                                 "FROM delayedlog2 WHERE journalid=$journalid AND posterid = $userid ".
+                                                "AND finaltime IS NULL " .
                                                 "LIMIT 1");
     return @$delayeds;
 }
@@ -813,7 +818,7 @@
 
     return $dbcr->selectcol_arrayref(  "SELECT posterid " .
                                        "FROM delayedlog2 ".
-                                       "WHERE journalid = $journalid GROUP BY posterid" );
+                                       "WHERE journalid = $journalid AND finaltime IS NULL GROUP BY posterid" );
 }
 
 sub get_entries_count {
@@ -838,7 +843,7 @@
 
     return $dbcr->selectrow_array(  "SELECT count(delayedid) " .
                                     "FROM delayedlog2 ".
-                                    "WHERE journalid=$journalid" );
+                                    "WHERE journalid=$journalid AND finaltime IS NULL" );
 }
 
 sub get_entries_by_journal {
@@ -889,7 +894,8 @@
     my $journalid = $journal->userid;
 
     return $dbcr->selectcol_arrayref("SELECT delayedid " .
-                                     "FROM delayedlog2 WHERE journalid=$journalid $sql_poster".
+                                     "FROM delayedlog2 WHERE journalid=$journalid $sql_poster ".
+                                     "AND finaltime IS NULL " .
                                      "ORDER BY $sticky_sql revptime DESC $sql_limit");
 }
 
@@ -916,6 +922,7 @@
 
     my ($id) = $dbcr->selectrow_array("SELECT delayedid " .
                                       "FROM delayedlog2 WHERE journalid=?  $sql_poster".
+                                      "AND finaltime IS NULL " .
                                       "ORDER BY is_sticky ASC, revptime DESC LIMIT 1", undef, $journal->userid);
     return $id || 0;
 }
@@ -942,6 +949,7 @@
 
     my ($id) = $dbcr->selectrow_array("SELECT delayedid " .
                                       "FROM delayedlog2 WHERE journalid=?  $sql_poster".
+                                      "AND finaltime IS NULL " .
                                       "ORDER BY is_sticky DESC, revptime ASC LIMIT 1", undef, $journal->userid);
     return $id || 0;
 }
@@ -993,6 +1001,7 @@
         if ($is_current_sticky) {
             my ($new_stime) = $dbr->selectrow_array("SELECT revptime " .
                                                     "FROM delayedlog2 WHERE journalid=? $sql_poster AND is_sticky = 0 ".
+                                                    "AND finaltime IS NULL " .
                                                     "ORDER BY revptime LIMIT 1", undef, $jid);
             if ($new_stime < $stime) {
                 $stime = $new_stime;
@@ -1007,6 +1016,7 @@
     my $result_ref = $dbr->selectcol_arrayref(  "SELECT delayedid FROM delayedlog2 use index (rlogtime,revptime) ".
                                                 "WHERE journalid=? AND $sql_item_rule AND delayedid <> ? ".
                                                 $sql_poster. " ".
+                                                "AND finaltime IS NULL " .
                                                 "ORDER BY is_sticky $order_sticky, revptime $order LIMIT 2",
                                                 undef, $jid, $stime, $delayedid);
     return 0 unless $result_ref;

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