mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-09-01 05:14 am

[dw-free] This doesn't end up doing anything unless someone is reimporting or we happen to get an en

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

This doesn't end up doing anything unless someone is reimporting or we
happen to get an entry again. But I figured out the exact steps and wanted
to get it committed so I don't have to find it again later. We should
figure out how to make a UI or something for this.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--------------------------------------------------------------------------------
diff -r b5bf8561aab5 -r 73a31b05bfbf cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Mon Aug 31 21:27:13 2009 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Tue Sep 01 05:14:21 2009 +0000
@@ -158,6 +158,10 @@ sub try_work {
             next;
         }
 
+        # FIXME: this is the key moment to "skip".  if we want a paid user or someone
+        # to get their picture keyword updated, we should skip them here.
+        # FIXME: this is a fixme because we should implement some way of making
+        # this available to users.
         delete $sync{$1 >> 8};
     }
     $log->( 'Syncitems now has %d items post-prune (first pass).', scalar( keys %sync ) );
@@ -197,6 +201,16 @@ sub try_work {
             $log->( '    %d %s %s; mapped = %d (import_source) || %d (xpost).',
                     $evt->{itemid}, $evt->{url}, $evt->{realtime}, $entry_map->{$evt->{key}},
                     $xpost_map->{$evt->{itemid}} );
+
+            # always set the picture_keyword property though, in case they're a paid
+            # user come back to fix their keywords.  this forcefully overwrites their
+            # local picture keyword
+            if ( my $jitemid = $entry_map->{$evt->{key}} ) {
+                my $entry = LJ::Entry->new( $u, jitemid => $jitemid );
+                $entry->set_prop( picture_keyword => $evt->{props}->{picture_keyword} );
+            }
+
+            # now try to skip it
             my $sync = delete $sync{$evt->{itemid}};
             return if $entry_map->{$evt->{key}} || !defined $sync || $xpost_map->{$evt->{itemid}};
 
--------------------------------------------------------------------------------