fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-11-12 09:27 am

[dw-free] Comment Imports sometimes blank

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

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

Update body and subject if the comment body is blank (we can't submit blank
comments, so this is likely an indication that something went wrong with the
import).

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/Local/Comments.pm
--------------------------------------------------------------------------------
diff -r 89fe44e3e37a -r faebcc7f9e5c cgi-bin/DW/Worker/ContentImporter/Local/Comments.pm
--- a/cgi-bin/DW/Worker/ContentImporter/Local/Comments.pm	Thu Nov 11 13:43:33 2010 +0800
+++ b/cgi-bin/DW/Worker/ContentImporter/Local/Comments.pm	Fri Nov 12 17:27:11 2010 +0800
@@ -71,6 +71,14 @@ sub update_comment {
     # edits and such.  for now, I'm just trying to get the icons to update...
     my $c = LJ::Comment->instance( $u, jtalkid => $cmt->{id} )
         or return $$errref = 'Unable to instantiate LJ::Comment object.';
+
+    # so we don't load the bodies of every comment ever
+    # (most of the time, we don't need to)
+    # empty body of a nondeleted comment indicates something went wrong with the import process
+    if ( $LJ::FIX_COMMENT_IMPORT{$u->user} && ! $c->is_deleted && $c->body_raw == "" ) {
+        $c->set_subject_and_body( $cmt->{subject}, $cmt->{body} );
+    }
+
     my $pu = $c->poster;
     if ( $pu && $pu->userpic_have_mapid ) {
         $c->set_prop( picture_mapid => $u->get_mapid_from_keyword( $cmt->{props}->{picture_keyword}, create => 1 ) );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org