summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-05-11 09:54:41 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-05-11 09:54:41 +0200
commitbc9729d82cbbba4533eb54a04ec0ad8a7b0fa7ad (patch)
tree416ba001a967fcd6e72ba6cd5df74e86da134617
parent1a0afb41ae304ce5d99155dc1765bb2c67bec3b1 (diff)
downloadbugzilla-bc9729d82cbbba4533eb54a04ec0ad8a7b0fa7ad.tar.gz
bugzilla-bc9729d82cbbba4533eb54a04ec0ad8a7b0fa7ad.tar.xz
Adapt flyspray migration to work without username and only email
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--Bugzilla/Migrate/Flyspray.pm22
1 files changed, 11 insertions, 11 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index c41d9cb96..3b7d51a1a 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
@@ -176,28 +176,28 @@ 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,
};
@@ -485,7 +485,7 @@ sub _read_bugs {
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;
}