diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-10-15 16:16:01 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-12-06 11:30:11 +0100 |
commit | ee884993aae404c92c6114b1d044d2e332d25fe1 (patch) | |
tree | 9044757258192693a792adaad902dfb5b24a59ee /Bugzilla | |
parent | 392c7fc0236c92629aa25ddcd11e1877252f32c0 (diff) | |
download | bugzilla-ee884993aae404c92c6114b1d044d2e332d25fe1.tar.gz bugzilla-ee884993aae404c92c6114b1d044d2e332d25fe1.tar.xz |
Flyspray: Create watch users
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Migrate/Flyspray.pm | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index b0fcf29e6..527997361 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -223,6 +223,17 @@ sub _read_users { return \@result; } +sub _add_user { + my $self = shift; + my $email = shift; + my $real_name = shift; + + my $item + = {login_name => $email, realname => $real_name, cryptpassword => "*",}; + push @{$self->{users}}, $item; + $self->{email_to_keep}->{$email} = 1; +} + sub _read_products { my $self = shift; @@ -236,9 +247,10 @@ sub _read_products { name => $row->{project_title}, description => $row->{intro_message} || "N/A", isactive => 1, - components => $self->_get_fs_project_components($row->{project_id}), - version => "unspecified", - groups => [ + components => + $self->_get_fs_project_components($row->{project_id}, $row->{project_title}), + version => "unspecified", + groups => [ { name => "private", description => "Private bug group", @@ -257,8 +269,11 @@ sub _read_products { } sub _get_fs_project_components { - my $self = shift; - my $project_id = shift; + my $self = shift; + my $project_id = shift; + my $project_title = shift; + + my $watch_project_title = ($project_title =~ s/[^a-zA-Z0-9]//gr); my $sth = $self->_select_fs( ["list_category"], @@ -268,24 +283,31 @@ sub _get_fs_project_components { my @result; while (my $row = $sth->fetchrow_hashref()) { + my $watch_component_name = ($row->{category_name} =~ s/[^a-zA-Z0-9]//gr); + my $watch_user = $watch_component_name . '@' . $watch_project_title . '.bugs'; push @result, { name => $row->{category_name}, description => "N/A", initialowner => $self->config("component_owner"), isactive => 1, + watch_user => $watch_user, }; + $self->_add_user($watch_user, undef); $self->{map_component_id_to_name}->{$row->{category_id}} = $row->{category_name}; $self->{project_id_components}->{$project_id}->{$row->{category_name}} = 1; } + my $watch_user = 'uncategorized@' . $watch_project_title . '.bugs'; push @result, { name => "Uncategorized", description => "N/A", initialowner => $self->config("component_owner"), isactive => 1, + watch_user => $watch_user, }; + $self->_add_user($watch_user, undef); $self->{map_component_id_to_name}->{-1} = "Uncategorized"; $self->debug(\@result, 3); |