summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Flag.pm
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-03-30 23:44:38 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-03-30 23:44:38 +0200
commit9eb2bae32768f300c56b3e91905f970de909221b (patch)
tree4366ae2723c55f3cf169af1a55393013023e7e58 /Bugzilla/Flag.pm
parentad7a26c7572f5969a895d6186b2c88b32f99b3c9 (diff)
downloadbugzilla-9eb2bae32768f300c56b3e91905f970de909221b.tar.gz
bugzilla-9eb2bae32768f300c56b3e91905f970de909221b.tar.xz
Bug 552167: show_bug.cgi loads flagtypes from the database for each attachment
r/a=mkanat
Diffstat (limited to 'Bugzilla/Flag.pm')
-rw-r--r--Bugzilla/Flag.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm
index e6b7bb936..ab8961967 100644
--- a/Bugzilla/Flag.pm
+++ b/Bugzilla/Flag.pm
@@ -54,6 +54,7 @@ whose names start with _ or a re specifically noted as being private.
=cut
use Scalar::Util qw(blessed);
+use Storable qw(dclone);
use Bugzilla::FlagType;
use Bugzilla::Hook;
@@ -1023,7 +1024,9 @@ sub _flag_types {
}
# Get all available flag types for the given product and component.
- my $flag_types = Bugzilla::FlagType::match($vars);
+ my $cache = Bugzilla->request_cache->{flag_types_per_component}->{$vars->{target_type}} ||= {};
+ my $flag_data = $cache->{$vars->{component_id}} ||= Bugzilla::FlagType::match($vars);
+ my $flag_types = dclone($flag_data);
$_->{flags} = [] foreach @$flag_types;
my %flagtypes = map { $_->id => $_ } @$flag_types;
@@ -1033,8 +1036,7 @@ sub _flag_types {
# or component).
@$flags = grep { exists $flagtypes{$_->type_id} } @$flags;
push(@{$flagtypes{$_->type_id}->{flags}}, $_) foreach @$flags;
-
- return [sort {$a->sortkey <=> $b->sortkey || $a->name cmp $b->name} values %flagtypes];
+ return $flag_types;
}
=head1 SEE ALSO