diff options
author | Byron Jones <bjones@mozilla.com> | 2013-12-06 18:24:33 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-12-06 18:24:33 +0100 |
commit | 07f5353454ce64657544640eca84dd06769dd8a3 (patch) | |
tree | 4176c277aada217cc365f0940d84692598c5cdc8 /extensions/Review/Extension.pm | |
parent | 5d5c9d240d31d9f19068272801f1ea9fe62b64e9 (diff) | |
download | bugzilla-07f5353454ce64657544640eca84dd06769dd8a3.tar.gz bugzilla-07f5353454ce64657544640eca84dd06769dd8a3.tar.xz |
Bug 942029: review suggestions only shows the first mentor
Diffstat (limited to 'extensions/Review/Extension.pm')
-rw-r--r-- | extensions/Review/Extension.pm | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index b00fc4e69..0aa21ad5b 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -32,7 +32,7 @@ BEGIN { *Bugzilla::Product::reviewer_required = \&_product_reviewer_required; *Bugzilla::Component::reviewers = \&_component_reviewers; *Bugzilla::Component::reviewers_objs = \&_component_reviewers_objs; - *Bugzilla::Bug::mentor = \&_bug_mentor; + *Bugzilla::Bug::mentors = \&_bug_mentors; *Bugzilla::User::review_count = \&_user_review_count; } @@ -72,29 +72,35 @@ sub _reviewers_objs { return $object->{reviewers}; } -sub _bug_mentor { +sub _bug_mentors { my ($self) = @_; - # extract the mentor from the status_whiteboard - # when the mentor gets its own field, this will be easier - if (!exists $self->{mentor}) { - my $mentor; - if ($self->status_whiteboard =~ /\[mentor=([^\]]+)\]/) { + # extract the mentors from the status_whiteboard + # when the mentors gets its own field, this will be easier + if (!exists $self->{mentors}) { + my @mentors; + my $whiteboard = $self->status_whiteboard; + while ($whiteboard =~ /\[mentor=([^\]]+)\]/g) { my $mentor_string = $1; + my $user; if ($mentor_string =~ /\@/) { # assume it's a full username if it contains an @ - $mentor = Bugzilla::User->new({ name => $mentor_string }); + $user = Bugzilla::User->new({ name => $mentor_string }); } else { # otherwise assume it's a : prefixed nick. only works if a # single user matches. - my $matches = Bugzilla::User::match("*:$mentor_string*", 2); - if ($matches && scalar(@$matches) == 1) { - $mentor = $matches->[0]; + foreach my $query ("*:$mentor_string*", "*$mentor_string*") { + my $matches = Bugzilla::User::match($query, 2); + if ($matches && scalar(@$matches) == 1) { + $user = $matches->[0]; + last; + } } } + push @mentors, $user if $user; } - $self->{mentor} = $mentor; + $self->{mentors} = \@mentors; } - return $self->{mentor}; + return $self->{mentors}; } sub _user_review_count { |