diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/Review/Extension.pm | 17 | ||||
-rw-r--r-- | extensions/Review/lib/WebService.pm | 1 | ||||
-rw-r--r-- | extensions/Review/template/en/default/hook/global/header-start.html.tmpl | 2 | ||||
-rw-r--r-- | extensions/Review/web/js/review.js | 8 |
4 files changed, 26 insertions, 2 deletions
diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 9a19f528c..12aca8065 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -31,6 +31,7 @@ BEGIN { *Bugzilla::Component::reviewers = \&_component_reviewers; *Bugzilla::Component::reviewers_objs = \&_component_reviewers_objs; *Bugzilla::Bug::mentor = \&_bug_mentor; + *Bugzilla::User::review_count = \&_user_review_count; } # @@ -93,6 +94,22 @@ sub _bug_mentor { return $self->{mentor}; } +sub _user_review_count { + my ($self) = @_; + if (!exists $self->{review_count}) { + ($self->{review_count}) = Bugzilla->dbh->selectrow_array( + "SELECT COUNT(*) + FROM flags + INNER JOIN flagtypes ON flagtypes.id = flags.type_id + WHERE flags.requestee_id = ? + AND flagtypes.name = ?", + undef, + $self->id, 'review', + ); + } + return $self->{review_count}; +} + # # reviewer-required # diff --git a/extensions/Review/lib/WebService.pm b/extensions/Review/lib/WebService.pm index e31244e5f..963d96233 100644 --- a/extensions/Review/lib/WebService.pm +++ b/extensions/Review/lib/WebService.pm @@ -52,6 +52,7 @@ sub suggestions { id => $self->type('int', $reviewer->id), email => $self->type('email', $reviewer->login), name => $self->type('string', $reviewer->name), + review_count => $self->type('int', $reviewer->review_count), }; } return \@result; diff --git a/extensions/Review/template/en/default/hook/global/header-start.html.tmpl b/extensions/Review/template/en/default/hook/global/header-start.html.tmpl index ebf206a33..e086e9b55 100644 --- a/extensions/Review/template/en/default/hook/global/header-start.html.tmpl +++ b/extensions/Review/template/en/default/hook/global/header-start.html.tmpl @@ -77,5 +77,5 @@ [% javascript = javascript _ review_js %] [% BLOCK reviewer %] - { login: '[% u.login FILTER js%]', identity: '[% u.identity FILTER js %]' } + { login: '[% u.login FILTER js%]', identity: '[% u.identity FILTER js %]', review_count: [% u.review_count FILTER js %] } [% END %] diff --git a/extensions/Review/web/js/review.js b/extensions/Review/web/js/review.js index 0dedd2410..6d0e24342 100644 --- a/extensions/Review/web/js/review.js +++ b/extensions/Review/web/js/review.js @@ -129,8 +129,14 @@ var REVIEW = { add_menu_item: function(field_idx, user, is_mentor) { var menu = REVIEW.fields[field_idx].menu; + var queue = ''; + if (user.review_count == 0) { + queue = 'empty queue'; + } else { + queue = user.review_count + ' review' + (user.review_count == 1 ? '' : 's') + ' in queue'; + } var item = menu.addItem( - { text: user.identity, url: '#' + user.login } + { text: user.identity + ' (' + queue + ')', url: '#' + user.login } ); if (is_mentor) item.cfg.setProperty('classname', 'mentor'); |