diff options
-rw-r--r-- | Bugzilla/Migrate/Flyspray.pm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 6f499bc4a..406bb8f66 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -108,7 +108,7 @@ END }, { name => 'component_owner', - default => 'bluewind', + default => 'bluewind@xinu.at', desc => <<'END', # The username of the user that is set as the initial owner for components. END @@ -183,29 +183,29 @@ sub _read_users { my @result; while (my $row = $sth->fetchrow_hashref()) { - next unless validate_email_syntax($row->{email_address}); + if (!validate_email_syntax($row->{email_address})) { + $self->debug("Skipping invalid email: " . $row->{email_address}, 3); + next; + } my $item = { - login_name => $row->{user_name} =~ s/\s//gr =~ s/@//gr, + login_name => $row->{email_address}, realname => $row->{real_name}, - email => $row->{email_address}, cryptpassword => "*", }; push @result, $item; - $self->{map_user_id_to_email}->{$row->{user_id}} = $item->{email}; - $self->{map_email_to_name}->{$row->{email_address}} = $item->{login_name}; + $self->{map_user_id_to_email}->{$row->{user_id}} = $item->{login_name}; } - # Remove duplicate users based on email; keep the latesst account + # Remove duplicate users based on email; keep the latest account my %seen; - @result = reverse grep { !$seen{$_->{email}}++ } reverse @result; + @result = reverse grep { !$seen{$_->{login_name}}++ } reverse @result; # fallback user for cases where the real user can not be # created or has been deleted push @result, { - login_name => 'UnknownUser', + login_name => $self->config("unknown_user_email"), realname => 'Unknown User', - email => $self->config("unknown_user_email"), cryptpassword => "*", is_enabled => 0, }; @@ -529,7 +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}; - return $self->{map_email_to_name}->{$email}; + return $email; } |