madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20408: LJSUP-10094: There is no warning on comm...

Committer: sbelyaev
LJSUP-10094: There is no warning on community/leave.bml page when user leaves community with delayed post where he is author
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/htdocs/community/leave.bml
U   trunk/htdocs/community/leave.bml.text
Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-23 14:35:52 UTC (rev 20407)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-23 17:27:44 UTC (rev 20408)
@@ -843,7 +843,19 @@
     return \%meta;
 }
 
+sub entries_exists {
+  my ( $journal, $user ) = @_;
+    __assert($journal, "no journal");
+    my $journalid = $journal->userid;
+    my $userid = $user->userid ;
+    my $dbcr = LJ::get_cluster_def_reader($journal)
+        or die "get cluster for journal failed";
 
+    return $dbcr->selectcol_arrayref("SELECT delayedid " .
+                                     "FROM delayedlog2 WHERE journalid=$journalid AND posterid = $userid ".
+                                     "LIMIT 1");    
+}
+
 sub get_entries_count {
     my ( $class, $journal, $skip, $elements_to_show, $userid ) = @_;
     __assert($journal, "no journal");

Modified: trunk/htdocs/community/leave.bml
===================================================================
--- trunk/htdocs/community/leave.bml	2011-10-23 14:35:52 UTC (rev 20407)
+++ trunk/htdocs/community/leave.bml	2011-10-23 17:27:44 UTC (rev 20408)
@@ -66,7 +66,10 @@
             $body .= BML::ml('.label.removed.stopwatch4', { 'commname' => LJ::ljuser($cu) });
         }
         $body .= " p?>";
-    } else {
+        if (LJ::DelayedEntry::entries_exists($cu, $remote)) {
+            $body .= BML::ml('.warning.delayed_entries');
+        }
+     } else {
         # show a confirmation form
         $body .= "<?h1 $ML{'.sure'} h1?><?p ";
         if ($watching && !$memberof) {

Modified: trunk/htdocs/community/leave.bml.text
===================================================================
--- trunk/htdocs/community/leave.bml.text	2011-10-23 14:35:52 UTC (rev 20407)
+++ trunk/htdocs/community/leave.bml.text	2011-10-23 17:27:44 UTC (rev 20408)
@@ -31,3 +31,5 @@
 
 .title.stopwatch=Stop Watching Community
 
+.warning.delayed_entries=All delayed entries are going to be deleted on publication date.
+

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