From 36b1ff47574758048c25de8b6cd4d4be01d90349 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 11 May 2018 12:09:27 +0200 Subject: Flyspray: Only migrate users that are necessary Signed-off-by: Florian Pritz --- Bugzilla/Migrate/Flyspray.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 406bb8f66..c38c21a35 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -529,6 +529,7 @@ sub _get_username { my ($self, $userid) = @_; my $email = $self->{map_user_id_to_email}->{$userid // -1} // $self->{map_user_id_to_email}->{-1}; + $self->{email_to_keep}->{$email} = 1; return $email; } @@ -543,6 +544,14 @@ sub translate_bug { return wantarray ? ($bug, $other_fields) : $bug; } +sub after_read { + my ($self) = @_; + + # only migrate users that have comments/attachments/are used somewhere + $self->{users} = [grep { defined $self->{email_to_keep}->{$_->{login_name}} } + @{$self->{users}}]; +} + sub after_insert { my ($self) = @_; -- cgit v1.2.3-24-g4f1b