diff options
-rw-r--r-- | Bugzilla/Attachment.pm | 5 | ||||
-rw-r--r-- | Bugzilla/Bug.pm | 11 | ||||
-rw-r--r-- | Bugzilla/BugMail.pm | 6 | ||||
-rw-r--r-- | Bugzilla/Comment.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Component.pm | 14 | ||||
-rw-r--r-- | Bugzilla/Flag.pm | 17 | ||||
-rw-r--r-- | Bugzilla/FlagType.pm | 3 |
7 files changed, 30 insertions, 30 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 094406c91..84bcedbd5 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -206,9 +206,8 @@ the user who attached the attachment sub attacher { my $self = shift; - return $self->{attacher} if exists $self->{attacher}; - $self->{attacher} = new Bugzilla::User($self->{submitter_id}); - return $self->{attacher}; + return $self->{attacher} + ||= new Bugzilla::User({ id => $self->{submitter_id}, cache => 1 }); } =over diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 4dcb6fe6e..15272e542 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3251,8 +3251,8 @@ sub assigned_to { my ($self) = @_; return $self->{'assigned_to_obj'} if exists $self->{'assigned_to_obj'}; $self->{'assigned_to'} = 0 if $self->{'error'}; - $self->{'assigned_to_obj'} ||= new Bugzilla::User($self->{'assigned_to'}); - return $self->{'assigned_to_obj'}; + return $self->{'assigned_to_obj'} + = new Bugzilla::User({ id => $self->{'assigned_to'}, cache => 1 }); } sub blocked { @@ -3512,7 +3512,8 @@ sub qa_contact { return undef if $self->{'error'}; if (Bugzilla->params->{'useqacontact'} && $self->{'qa_contact'}) { - $self->{'qa_contact_obj'} = new Bugzilla::User($self->{'qa_contact'}); + $self->{'qa_contact_obj'} + = new Bugzilla::User({ id => $self->{'qa_contact'}, cache => 1 }); } else { # XXX - This is somewhat inconsistent with the assignee/reporter # methods, which will return an empty User if they get a 0. @@ -3526,8 +3527,8 @@ sub reporter { my ($self) = @_; return $self->{'reporter'} if exists $self->{'reporter'}; $self->{'reporter_id'} = 0 if $self->{'error'}; - $self->{'reporter'} = new Bugzilla::User($self->{'reporter_id'}); - return $self->{'reporter'}; + return $self->{'reporter'} + = new Bugzilla::User({ id => $self->{'reporter_id'}, cache => 1 }); } sub see_also { diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index a2501a99c..6e7fc7b80 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -210,7 +210,7 @@ sub Send { # Make sure %user_cache has every user in it so far referenced foreach my $user_id (keys %recipients) { - $user_cache{$user_id} ||= new Bugzilla::User($user_id); + $user_cache{$user_id} ||= new Bugzilla::User({ id => $user_id, cache => 1 }); } Bugzilla::Hook::process('bugmail_recipients', @@ -259,7 +259,7 @@ sub Send { foreach my $user_id (keys %recipients) { my %rels_which_want; - my $user = $user_cache{$user_id} ||= new Bugzilla::User($user_id); + my $user = $user_cache{$user_id} ||= new Bugzilla::User({ id => $user_id, cache => 1 }); # Deleted users must be excluded. next unless $user; @@ -505,7 +505,7 @@ sub _get_diffs { my $referenced_bugs = []; foreach my $diff (@$diffs) { - $user_cache->{$diff->{who}} ||= new Bugzilla::User($diff->{who}); + $user_cache->{$diff->{who}} ||= new Bugzilla::User({ id => $diff->{who}, cache => 1 }); $diff->{who} = $user_cache->{$diff->{who}}; if ($diff->{attach_id}) { $diff->{isprivate} = $dbh->selectrow_array( diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm index ae68e3916..4559cf1fd 100644 --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -150,8 +150,8 @@ sub attachment { sub author { my $self = shift; - $self->{'author'} ||= new Bugzilla::User($self->{'who'}); - return $self->{'author'}; + return $self->{'author'} + ||= new Bugzilla::User({ id => $self->{'who'}, cache => 1 }); } sub body_full { diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index ad5166a0f..0fe6fb25a 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -352,20 +352,18 @@ sub bug_ids { sub default_assignee { my $self = shift; - - if (!defined $self->{'default_assignee'}) { - $self->{'default_assignee'} = - new Bugzilla::User($self->{'initialowner'}); - } - return $self->{'default_assignee'}; + return $self->{'default_assignee'} + ||= new Bugzilla::User({ id => $self->{'initialowner'}, cache => 1 }); } sub default_qa_contact { my $self = shift; if (!defined $self->{'default_qa_contact'}) { - $self->{'default_qa_contact'} = - new Bugzilla::User($self->{'initialqacontact'}); + my $params = $self->{'initialqacontact'} + ? { id => $self->{'initialqacontact'}, cache => 1 } + : $self->{'initialqacontact'}; + $self->{'default_qa_contact'} = new Bugzilla::User($params); } return $self->{'default_qa_contact'}; } diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm index 5f4f90b6c..76c035a7a 100644 --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -203,15 +203,16 @@ sub type { sub setter { my $self = shift; - $self->{'setter'} ||= new Bugzilla::User($self->{'setter_id'}); - return $self->{'setter'}; + return $self->{'setter' } + ||= new Bugzilla::User({ id => $self->{'setter_id'}, cache => 1 }); } sub requestee { my $self = shift; if (!defined $self->{'requestee'} && $self->{'requestee_id'}) { - $self->{'requestee'} = new Bugzilla::User($self->{'requestee_id'}); + $self->{'requestee'} + = new Bugzilla::User({ id => $self->{'requestee_id'}, cache => 1 }); } return $self->{'requestee'}; } @@ -221,16 +222,16 @@ sub attachment { return undef unless $self->attach_id; require Bugzilla::Attachment; - $self->{'attachment'} ||= new Bugzilla::Attachment($self->attach_id); - return $self->{'attachment'}; + return $self->{'attachment'} + ||= new Bugzilla::Attachment({ id => $self->attach_id, cache => 1 }); } sub bug { my $self = shift; require Bugzilla::Bug; - $self->{'bug'} ||= new Bugzilla::Bug({ id => $self->bug_id, cache => 1 }); - return $self->{'bug'}; + return $self->{'bug'} + ||= new Bugzilla::Bug({ id => $self->bug_id, cache => 1 }); } ################################ @@ -1000,7 +1001,7 @@ sub notify { my %recipients; foreach my $cc (split(/[, ]+/, $cc_list)) { - my $ccuser = new Bugzilla::User({ name => $cc }); + my $ccuser = new Bugzilla::User({ name => $cc, cache => 1 }); next if (scalar(@bug_in_groups) && (!$ccuser || !$ccuser->can_see_bug($bug->bug_id))); next if $attachment_is_private && (!$ccuser || !$ccuser->is_insider); # Prevent duplicated entries due to case sensitivity. diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index f2afb6f95..910e2d425 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -468,7 +468,8 @@ sub grant_list { my @custusers; my @allusers = @{Bugzilla->user->get_userlist}; foreach my $user (@allusers) { - my $user_obj = new Bugzilla::User({name => $user->{login}}); + my $user_obj + = new Bugzilla::User({ name => $user->{login}, cache => 1 }); push(@custusers, $user) if $user_obj->can_set_flag($self); } return \@custusers; |