]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1543189 - Add search pronouns: %triageowner% and %self%
authorKohei Yoshino <kohei.yoshino@gmail.com>
Thu, 25 Apr 2019 21:55:38 +0000 (17:55 -0400)
committerGitHub <noreply@github.com>
Thu, 25 Apr 2019 21:55:38 +0000 (17:55 -0400)
Bugzilla/Search.pm
docs/en/rst/using/finding.rst

index 72fc275a455b324cc23d34df0506a8dff41f2204..b5ce8ad52d2297d877a75a37079f34262db6d317 100644 (file)
@@ -342,6 +342,8 @@ sub SPECIAL_PARSING {
     commenter               => \&_commenter_pronoun,
     qa_contact              => \&_contact_pronoun,
     reporter                => \&_contact_pronoun,
+    'requestees.login_name' => \&_contact_pronoun,
+    'setters.login_name'    => \&_contact_pronoun,
 
     # Date Fields that accept the 1d, 1w, 1m, 1y, etc. format.
     creation_ts => \&_datetime_translate,
@@ -2315,7 +2317,7 @@ sub SqlifyDate {
 
 sub pronoun {
   my ($noun, $user) = (@_);
-  if ($noun eq "%user%") {
+  if ($noun eq "%user%" || $noun eq "%self%") {
     if ($user->id) {
       return $user->id;
     }
@@ -2326,6 +2328,11 @@ sub pronoun {
   if ($noun eq "%reporter%") {
     return "bugs.reporter";
   }
+  if ($noun eq "%triageowner%") {
+    return "(SELECT COALESCE(userid, 0) FROM profiles
+      JOIN components ON components.triage_owner_id = profiles.userid
+      WHERE bugs.component_id = components.id)";
+  }
   if ($noun eq "%assignee%") {
     return "bugs.assigned_to";
   }
@@ -2468,7 +2475,7 @@ sub _triage_owner_pronoun {
   my ($self, $args) = @_;
   my $value = $args->{value};
   my $user  = $self->_user;
-  if ($value eq "%user%") {
+  if ($value eq "%user%" || $value eq "%self%") {
     if ($user->id) {
       $args->{value}       = $user->id;
       $args->{quoted}      = $args->{value};
index baf2d9076d7eebe6ff3fbe6bc9fab668d8409e3f..9dc848134ca06042e4f45aeea3ed96eaaeee3df5 100644 (file)
@@ -184,12 +184,13 @@ example, you may want to find all bugs that are assigned to the person
 who reported them.
 
 When the :guilabel:`Custom Search` operator is either :guilabel:`equals` or
-:guilabel:`notequals`, the value can be "%reporter%", "%assignee%",
-"%qacontact%", or "%user%". These are known as "pronouns". The user pronoun
-refers to the user who is executing the query or, in the case
-of whining reports, the user who will be the recipient
-of the report. The reporter, assignee, and qacontact
-pronouns refer to the corresponding fields in the bug.
+:guilabel:`notequals`, the value can be ``%reporter%``, ``%triageowner%``,
+``%assignee%``, ``%qacontact%``, ``%user%`` or ``%self%``. These are known as
+"pronouns". The ``%user%`` pronoun and its alias ``%self%`` refer to the user
+who is executing the query (that's you) or, in the case of whining reports, the
+user who will be the recipient of the report. The ``%reporter%``,
+``%triageowner%``, ``%assignee%`` and ``%qacontact%`` pronouns refer to the
+corresponding fields in the bug.
 
 This feature also lets you search by a user's group memberships. If the
 operator is either :guilabel:`equals`, :guilabel:`notequals` or