summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags/lib
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/TrackingFlags/lib')
-rw-r--r--extensions/TrackingFlags/lib/Flag.pm10
-rw-r--r--extensions/TrackingFlags/lib/Flag/Value.pm7
2 files changed, 15 insertions, 2 deletions
diff --git a/extensions/TrackingFlags/lib/Flag.pm b/extensions/TrackingFlags/lib/Flag.pm
index cfda0bad5..7b6effa98 100644
--- a/extensions/TrackingFlags/lib/Flag.pm
+++ b/extensions/TrackingFlags/lib/Flag.pm
@@ -87,6 +87,16 @@ sub new {
return $class->SUPER::new($param);
}
+sub new_from_hash {
+ my $class = shift;
+ my $cache = Bugzilla->request_cache->{'tracking_flags'} //= {};
+ my $flag = $class->SUPER::new_from_hash(@_);
+ if ($flag) {
+ push @Bugzilla::Extension::TrackingFlags::FLAG_CACHE, $flag;
+ }
+ return $flag;
+}
+
sub create {
my $class = shift;
my $params = shift;
diff --git a/extensions/TrackingFlags/lib/Flag/Value.pm b/extensions/TrackingFlags/lib/Flag/Value.pm
index 964d76810..15be61bc7 100644
--- a/extensions/TrackingFlags/lib/Flag/Value.pm
+++ b/extensions/TrackingFlags/lib/Flag/Value.pm
@@ -15,7 +15,7 @@ use warnings;
use Bugzilla::Error;
use Bugzilla::Group;
use Bugzilla::Util qw(detaint_natural trim);
-use Scalar::Util qw(blessed);
+use Scalar::Util qw(blessed weaken);
###############################
#### Initialization ####
@@ -118,9 +118,12 @@ sub is_active { return $_[0]->{'is_active'}; }
sub comment { return $_[0]->{'comment'}; }
sub tracking_flag {
- return $_[0]->{'tracking_flag'} ||= Bugzilla::Extension::TrackingFlags::Flag->new({
+ return $_[0]->{'tracking_flag'} if $_[0]->{'tracking_flag'};
+ my $tf = $_[0]->{'tracking_flag'} = Bugzilla::Extension::TrackingFlags::Flag->new({
id => $_[0]->tracking_flag_id, cache => 1
});
+ weaken($_[0]->{'tracking_flag'});
+ return $tf;
}
sub setter_group {