fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-02 04:03 pm

[dw-free] Empty/default properties are saved in the DB when comments are edited

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

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

Delete empty / blank properties instead of trying to insert them into the
DB.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Talk.pm
--------------------------------------------------------------------------------
diff -r 18fef44fc6ef -r c4e64102ea42 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Sat Oct 02 01:52:00 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm	Sun Oct 03 00:03:48 2010 +0800
@@ -3691,6 +3691,9 @@ sub edit_comment {
         edit_reason => $comment->{editreason},
     );
 
+    # remove blank/0 values (defaults)
+    foreach ( keys %props ) { delete $props{$_} unless $props{$_}; }
+
     my $pu = $comment_obj->poster;
     if ( $pu && $pu->userpic_have_mapid ) {
         $props{picture_mapid} = $pu->get_mapid_from_keyword( $comment->{picture_keyword} );
--------------------------------------------------------------------------------