From 392c7fc0236c92629aa25ddcd11e1877252f32c0 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 10 Jul 2018 23:27:17 +0200 Subject: Flyspray: Add private bug support Signed-off-by: Florian Pritz --- Bugzilla/Migrate.pm | 16 ++++++++++++++++ Bugzilla/Migrate/Flyspray.pm | 17 ++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm index dce795400..e074d4c01 100644 --- a/Bugzilla/Migrate.pm +++ b/Bugzilla/Migrate.pm @@ -584,6 +584,7 @@ sub insert_products { my ($self, $products) = @_; foreach my $product (@$products) { my $components = delete $product->{components}; + my $groups = delete $product->{groups}; my $created_prod = new Bugzilla::Product({name => $product->{name}}); if (!$created_prod) { @@ -591,6 +592,21 @@ sub insert_products { print get_text('migrate_product_created', {created => $created_prod}), "\n"; } + for my $group (@$groups) { + my $group_id = new Bugzilla::Group({name => $group->{name}}); + if (!$group_id) { + $group_id = Bugzilla::Group->create({ + name => $group->{name}, + description => $group->{description}, + isbuggroup => 1, + isactive => 1, + owner_user_id => $group->{owner}, + }); + } + $created_prod->set_group_controls($group_id, $group->{settings}); + $created_prod->update(); + } + foreach my $component (@$components) { next if new Bugzilla::Component({ diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index d96ebeaf4..b0fcf29e6 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -50,6 +50,7 @@ use constant FIELD_MAP => { 'comments' => 'comments', 'history' => 'history', 'attachments' => 'attachments', + 'groups' => 'groups', }; use constant VALUE_MAP => { @@ -237,6 +238,15 @@ sub _read_products { isactive => 1, components => $self->_get_fs_project_components($row->{project_id}), version => "unspecified", + groups => [ + { + name => "private", + description => "Private bug group", + owner => $self->_get_username(-1), + settings => + {"membercontrol" => CONTROLMAPSHOWN, "othercontrol" => CONTROLMAPSHOWN,} + }, + ], }; $self->{map_project_id_to_name}->{$row->{project_id}} = $row->{project_title}; } @@ -318,9 +328,6 @@ sub _read_bugs { my @result; while (my $row = $sth->fetchrow_hashref()) { - if ($row->{mark_private} == 1) { - ...; - } $self->debug("Processing bug " . $row->{task_id}, 2); my $bug = { short_desc => $row->{item_summary}, @@ -351,6 +358,10 @@ sub _read_bugs { if not defined $self->{project_id_components}->{$row->{project_id}} ->{$bug->{component}}; + if ($row->{mark_private} == 1) { + $bug->{groups} = ["private"]; + } + # handle initial comment/description if (length($bug->{comment}) > 65535) { $bug->{comment} -- cgit v1.2.3-24-g4f1b