summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-09-08 23:21:24 +0200
committerlpsolit%gmail.com <>2008-09-08 23:21:24 +0200
commit4dd427ea99673391d923db9682836d344f178b54 (patch)
tree15cac366546a970dfbe8a0ed7163976f09dfbfb2 /Bugzilla/Bug.pm
parent1d66aab134be7002268c4da177bbf4870ac90d6d (diff)
downloadbugzilla-4dd427ea99673391d923db9682836d344f178b54.tar.gz
bugzilla-4dd427ea99673391d923db9682836d344f178b54.tar.xz
Bug 453743: Decrease the number of calls to the DB about flags when viewing a bug - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm22
1 files changed, 6 insertions, 16 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index d625953a9..14f781c42 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2314,7 +2314,7 @@ sub attachments {
return [] if $self->{'error'};
$self->{'attachments'} =
- Bugzilla::Attachment->get_attachments_by_bug($self->bug_id);
+ Bugzilla::Attachment->get_attachments_by_bug($self->bug_id, {preload => 1});
return $self->{'attachments'};
}
@@ -2421,22 +2421,12 @@ sub flag_types {
return $self->{'flag_types'} if exists $self->{'flag_types'};
return [] if $self->{'error'};
- # The types of flags that can be set on this bug.
- # If none, no UI for setting flags will be displayed.
- my $flag_types = Bugzilla::FlagType::match(
- {'target_type' => 'bug',
- 'product_id' => $self->{'product_id'},
- 'component_id' => $self->{'component_id'} });
-
- foreach my $flag_type (@$flag_types) {
- $flag_type->{'flags'} = Bugzilla::Flag->match(
- { 'bug_id' => $self->bug_id,
- 'type_id' => $flag_type->{'id'},
- 'target_type' => 'bug' });
- }
-
- $self->{'flag_types'} = $flag_types;
+ my $vars = { target_type => 'bug',
+ product_id => $self->{product_id},
+ component_id => $self->{component_id},
+ bug_id => $self->bug_id };
+ $self->{'flag_types'} = Bugzilla::Flag::_flag_types($vars);
return $self->{'flag_types'};
}