fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-04-19 01:56 pm

[dw-free] Fix occasional incorrect "entry dated out of order without tickeh" errors

[commit: http://hg.dwscoalition.org/dw-free/rev/5fc0877f7daa]

http://bugs.dwscoalition.org/show_bug.cgi?id=3029

Reverse the order of the if/else to catch some cases where we'd get an error
message about an entry needing to be dated out of order (when it doesn't
need to be).

Patch from LiveJournal, packaged for Dreamwidth by [personal profile] fu.

Files modified:
  • cgi-bin/ljprotocol.pl
--------------------------------------------------------------------------------
diff -r e89c761f0bb5 -r 5fc0877f7daa cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Tue Apr 19 21:07:43 2011 +0800
+++ b/cgi-bin/ljprotocol.pl	Tue Apr 19 21:56:07 2011 +0800
@@ -1977,15 +1977,16 @@ sub editevent
     {
         # are they changing their most recent post?
         if ( $u->equals( $uowner ) &&
-             $u->prop( "newesteventtime" ) eq $oldevent->{eventtime} ) {
-            # did they change the time?
-            if ($eventtime ne $oldevent->{eventtime}) {
+            $u->prop( "newesteventtime" ) eq $oldevent->{eventtime} ) {
+
+            if ( ! $curprops{$itemid}->{opt_backdated} && $req->{props}{opt_backdated} ) {
+                # if they set the backdated flag, then we no longer know
+                # the newesteventtime.
+                $u->set_prop( "newesteventtime", undef );
+            } elsif ( $eventtime ne $oldevent->{eventtime} ) {
+                # otherwise, if they changed time on this event,
                 # the newesteventtime is this event's new time.
                 $u->set_prop( "newesteventtime", $eventtime );
-            } elsif (!$curprops{$itemid}->{opt_backdated} && $req->{props}{opt_backdated}) {
-                # otherwise, if they set the backdated flag,
-                # then we no longer know the newesteventtime.
-                $u->set_prop( "newesteventtime", undef );
             }
         }
 
--------------------------------------------------------------------------------