[dw-free] Importer should bypass ESN, fire no notifications
[commit: http://hg.dwscoalition.org/dw-free/rev/5cde73204900]
http://bugs.dwscoalition.org/show_bug.cgi?id=330
Do not notify on userpic imports.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=330
Do not notify on userpic imports.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/Worker/ContentImporter/Local/Userpics.pm
- cgi-bin/LJ/Userpic.pm
-------------------------------------------------------------------------------- diff -r d19df663fa4d -r 5cde73204900 cgi-bin/DW/Worker/ContentImporter/Local/Userpics.pm --- a/cgi-bin/DW/Worker/ContentImporter/Local/Userpics.pm Wed Apr 01 03:56:40 2009 +0000 +++ b/cgi-bin/DW/Worker/ContentImporter/Local/Userpics.pm Wed Apr 01 04:32:41 2009 +0000 @@ -144,7 +144,7 @@ sub import_userpic { return 0; } else { - $userpic = eval { LJ::Userpic->create( $u, data => \$data ); }; + $userpic = eval { LJ::Userpic->create( $u, data => \$data, nonotify => 1 ); }; unless ( $userpic ) { push @$errors, "Icon '$identifier': " . $@->as_string; return 0; diff -r d19df663fa4d -r 5cde73204900 cgi-bin/LJ/Userpic.pm --- a/cgi-bin/LJ/Userpic.pm Wed Apr 01 03:56:40 2009 +0000 +++ b/cgi-bin/LJ/Userpic.pm Wed Apr 01 04:32:41 2009 +0000 @@ -571,16 +571,17 @@ sub load_user_userpics { # set cache if reasonable $class->set_cache($u, \@ret); - + return map { LJ::Userpic->new_from_row($_) } @ret; } sub create { - my ($class, $u, %opts) = @_; + my ( $class, $u, %opts ) = @_; local $LJ::THROW_ERRORS = 1; - my $dataref = delete $opts{'data'}; - my $maxbytesize = delete $opts{'maxbytesize'}; + my $dataref = delete $opts{data}; + my $maxbytesize = delete $opts{maxbytesize}; + my $nonotify = delete $opts{nonotify}; croak("dataref not a scalarref") unless ref $dataref eq 'SCALAR'; croak("Unknown options: " . join(", ", scalar keys %opts)) if %opts; @@ -722,10 +723,10 @@ sub create { LJ::throw(@errors); # now that we've created a new pic, invalidate the user's memcached userpic info - LJ::Userpic->delete_cache($u); + LJ::Userpic->delete_cache( $u ); - my $upic = LJ::Userpic->new($u, $picid) or die "Error insantiating userpic"; - LJ::Event::NewUserpic->new($upic)->fire unless $LJ::DISABLED{esn}; + my $upic = LJ::Userpic->new( $u, $picid ) or die "Error insantiating userpic"; + LJ::Event::NewUserpic->new( $upic )->fire unless $LJ::DISABLED{esn} || $nonotify; return $upic; } --------------------------------------------------------------------------------