From a88fc0757d5bd8e70cad0572ab4d29a8817beb84 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 5 Jan 2007 01:48:16 +0000 Subject: Bug 364216: Flag::retarget() is broken (again) - Patch by Frédéric Buclin r/a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editflagtypes.cgi | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'editflagtypes.cgi') diff --git a/editflagtypes.cgi b/editflagtypes.cgi index 6e001a525..0aec0385d 100755 --- a/editflagtypes.cgi +++ b/editflagtypes.cgi @@ -387,8 +387,7 @@ sub update { # Clear existing flags for bugs/attachments in categories no longer on # the list of inclusions or that have been added to the list of exclusions. - my $flags = $dbh->selectall_arrayref('SELECT DISTINCT flags.id, flags.bug_id, - flags.attach_id + my $flag_ids = $dbh->selectcol_arrayref('SELECT DISTINCT flags.id FROM flags INNER JOIN bugs ON flags.bug_id = bugs.bug_id @@ -401,14 +400,13 @@ sub update { WHERE flags.type_id = ? AND i.type_id IS NULL', undef, $id); + my $flags = Bugzilla::Flag->new_from_list($flag_ids); foreach my $flag (@$flags) { - my ($flag_id, $bug_id, $attach_id) = @$flag; - my $bug = new Bugzilla::Bug($bug_id); - my $attachment = $attach_id ? Bugzilla::Attachment->get($attach_id) : undef; - Bugzilla::Flag::clear($flag_id, $bug, $attachment); + my $bug = new Bugzilla::Bug($flag->bug_id); + Bugzilla::Flag::clear($flag, $bug, $flag->attachment); } - $flags = $dbh->selectall_arrayref('SELECT DISTINCT flags.id, flags.bug_id, flags.attach_id + $flag_ids = $dbh->selectcol_arrayref('SELECT DISTINCT flags.id FROM flags INNER JOIN bugs ON flags.bug_id = bugs.bug_id @@ -420,11 +418,10 @@ sub update { AND (bugs.component_id = e.component_id OR e.component_id IS NULL)', undef, $id); + $flags = Bugzilla::Flag->new_from_list($flag_ids); foreach my $flag (@$flags) { - my ($flag_id, $bug_id, $attach_id) = @$flag; - my $bug = new Bugzilla::Bug($bug_id); - my $attachment = $attach_id ? Bugzilla::Attachment->get($attach_id) : undef; - Bugzilla::Flag::clear($flag_id, $bug, $attachment); + my $bug = new Bugzilla::Bug($flag->bug_id); + Bugzilla::Flag::clear($flag, $bug, $flag->attachment); } # Now silently remove requestees from flags which are no longer -- cgit v1.2.3-24-g4f1b