]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1560245 - Specify missing bug field types
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 26 Jun 2019 17:32:04 +0000 (13:32 -0400)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2019 17:32:04 +0000 (13:32 -0400)
Bugzilla/Constants.pm
Bugzilla/Field.pm
extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl [deleted file]
extensions/RestrictComments/Extension.pm
extensions/Review/Extension.pm
extensions/Voting/Extension.pm
template/en/default/global/field-descs.none.tmpl

index 45c84ace2c5772810d8c984fc859c138906ec72e..02d3e559a8f45218257661170593979055c44507 100644 (file)
@@ -117,6 +117,10 @@ use Memoize;
   FIELD_TYPE_BUG_URLS
   FIELD_TYPE_KEYWORDS
   FIELD_TYPE_INTEGER
+  FIELD_TYPE_BOOLEAN
+  FIELD_TYPE_USER
+  FIELD_TYPE_USERS
+  FIELD_TYPE_BUG_LIST
   FIELD_TYPE_EXTENSION
 
   FIELD_TYPE_HIGHEST_PLUS_ONE
@@ -423,6 +427,10 @@ use constant FIELD_TYPE_BUG_URLS      => 7;
 use constant FIELD_TYPE_KEYWORDS      => 8;
 use constant FIELD_TYPE_DATE          => 9;
 use constant FIELD_TYPE_INTEGER       => 10;
+use constant FIELD_TYPE_BOOLEAN       => 11;
+use constant FIELD_TYPE_USER          => 20;
+use constant FIELD_TYPE_USERS         => 21;
+use constant FIELD_TYPE_BUG_LIST      => 22;
 use constant FIELD_TYPE_EXTENSION     => 99;
 
 # Add new field types above this line, and change the below value in the
index 6aa6c71ad06cee7fddff08f2a76e861762cb4481..5f581e3775054e3f48dd414d0b362c9ae95d9b83 100644 (file)
@@ -271,16 +271,35 @@ use constant DEFAULT_FIELDS => (
   },
   {
     name           => 'assigned_to',
-    desc           => 'AssignedTo',
+    desc           => 'Assignee',
+    type           => FIELD_TYPE_USER,
+    in_new_bugmail => 1,
+    buglist        => 1,
+  },
+  {
+    name           => 'reporter',
+    desc           => 'Reporter',
+    type           => FIELD_TYPE_USER,
     in_new_bugmail => 1,
     buglist        => 1
   },
-  {name => 'reporter',   desc => 'ReportedBy', in_new_bugmail => 1, buglist => 1},
-  {name => 'qa_contact', desc => 'QAContact',  in_new_bugmail => 1, buglist => 1},
-  {name => 'cc',         desc => 'CC',         in_new_bugmail => 1},
+  {
+    name           => 'qa_contact',
+    desc           => 'QA Contact',
+    type           => FIELD_TYPE_USER,
+    in_new_bugmail => 1,
+    buglist        => 1,
+  },
+  {
+    name           => 'cc',
+    desc           => 'CC',
+    type           => FIELD_TYPE_USERS,
+    in_new_bugmail => 1,
+  },
   {
     name           => 'dependson',
     desc           => 'Depends on',
+    type           => FIELD_TYPE_BUG_LIST,
     in_new_bugmail => 1,
     is_numeric     => 1,
     buglist        => 1
@@ -288,6 +307,7 @@ use constant DEFAULT_FIELDS => (
   {
     name           => 'blocked',
     desc           => 'Blocks',
+    type           => FIELD_TYPE_BUG_LIST,
     in_new_bugmail => 1,
     is_numeric     => 1,
     buglist        => 1
@@ -295,6 +315,7 @@ use constant DEFAULT_FIELDS => (
   {
     name           => 'regressed_by',
     desc           => 'Regressed by',
+    type           => FIELD_TYPE_BUG_LIST,
     in_new_bugmail => 1,
     is_numeric     => 1,
     buglist        => 1
@@ -302,6 +323,7 @@ use constant DEFAULT_FIELDS => (
   {
     name           => 'regresses',
     desc           => 'Regressions',
+    type           => FIELD_TYPE_BUG_LIST,
     in_new_bugmail => 1,
     is_numeric     => 1,
     buglist        => 1
@@ -310,44 +332,88 @@ use constant DEFAULT_FIELDS => (
   {
     name    => 'assignee_last_login',
     desc    => 'Assignee Last Login Date',
+    type    => FIELD_TYPE_DATE,
     buglist => 1
   },
 
   {name => 'attachments.description', desc => 'Attachment description'},
   {name => 'attachments.filename',    desc => 'Attachment filename'},
   {name => 'attachments.mimetype',    desc => 'Attachment mime type'},
-  {name => 'attachments.ispatch', desc => 'Attachment is patch', is_numeric => 1},
+  {
+    name       => 'attachments.ispatch',
+    desc       => 'Attachment is patch',
+    type       => FIELD_TYPE_BOOLEAN,
+    is_numeric => 1,
+  },
   {
     name       => 'attachments.isobsolete',
     desc       => 'Attachment is obsolete',
+    type       => FIELD_TYPE_BOOLEAN,
     is_numeric => 1
   },
   {
     name       => 'attachments.isprivate',
     desc       => 'Attachment is private',
+    type       => FIELD_TYPE_BOOLEAN,
     is_numeric => 1
   },
-  {name => 'attachments.submitter', desc => 'Attachment creator'},
+  {
+    name => 'attachments.submitter',
+    desc => 'Attachment Creator',
+    type => FIELD_TYPE_USER,
+  },
 
   {name => 'target_milestone',    desc => 'Target Milestone',   buglist    => 1},
-  {name => 'creation_ts',         desc => 'Creation date',      buglist    => 1},
-  {name => 'delta_ts',            desc => 'Last changed date',  buglist    => 1},
+  {
+    name    => 'creation_ts',
+    desc    => 'Opened',
+    type    => FIELD_TYPE_DATETIME,
+    buglist => 1,
+  },
+  {
+    name    => 'delta_ts',
+    desc    => 'Updated',
+    type    => FIELD_TYPE_DATETIME,
+    buglist => 1,
+  },
   {name => 'longdesc',            desc => 'Comment'},
-  {name => 'longdescs.isprivate', desc => 'Comment is private', is_numeric => 1},
+  {
+    name       => 'longdescs.isprivate',
+    desc       => 'Comment is private',
+    type       => FIELD_TYPE_BOOLEAN,
+    is_numeric => 1,
+  },
   {
     name       => 'longdescs.count',
     desc       => 'Number of Comments',
+    type       => FIELD_TYPE_INTEGER,
     buglist    => 1,
     is_numeric => 1
   },
   {name => 'alias',               desc => 'Alias',               buglist    => 1},
-  {name => 'everconfirmed',       desc => 'Ever Confirmed',      is_numeric => 1},
-  {name => 'reporter_accessible', desc => 'Reporter Accessible', is_numeric => 1},
-  {name => 'cclist_accessible',   desc => 'CC Accessible',       is_numeric => 1},
+  {
+    name       => 'everconfirmed',
+    desc       => 'Ever Confirmed',
+    type       => FIELD_TYPE_BOOLEAN,
+    is_numeric => 1,
+  },
+  {
+    name       => 'reporter_accessible',
+    desc       => 'Reporter Accessible',
+    type       => FIELD_TYPE_BOOLEAN,
+    is_numeric => 1,
+  },
+  {
+    name       => 'cclist_accessible',
+    desc       => 'CC Accessible',
+    type       => FIELD_TYPE_BOOLEAN,
+    is_numeric => 1,
+  },
   {name => 'bug_group', desc => 'Group', in_new_bugmail => 1},
   {
     name           => 'estimated_time',
     desc           => 'Estimated Hours',
+    type           => FIELD_TYPE_INTEGER,
     in_new_bugmail => 1,
     buglist        => 1,
     is_numeric     => 1
@@ -355,6 +421,7 @@ use constant DEFAULT_FIELDS => (
   {
     name       => 'remaining_time',
     desc       => 'Remaining Hours',
+    type       => FIELD_TYPE_INTEGER,
     buglist    => 1,
     is_numeric => 1
   },
@@ -365,14 +432,33 @@ use constant DEFAULT_FIELDS => (
     in_new_bugmail => 1,
     buglist        => 1
   },
-  {name => 'commenter',             desc => 'Commenter'},
+  {
+    name => 'commenter',
+    desc => 'Commenter',
+    type => FIELD_TYPE_USER,
+  },
   {name => 'flagtypes.name',        desc => 'Flags', buglist => 1},
-  {name => 'requestees.login_name', desc => 'Flag Requestee'},
-  {name => 'setters.login_name',    desc => 'Flag Setter'},
-  {name => 'work_time', desc => 'Hours Worked', buglist => 1, is_numeric => 1},
+  {
+    name => 'requestees.login_name',
+    desc => 'Flag Requestee',
+    type => FIELD_TYPE_USER,
+  },
+  {
+    name => 'setters.login_name',
+    desc => 'Flag Setter',
+    type => FIELD_TYPE_USER,
+  },
+  {
+    name       => 'work_time',
+    desc       => 'Hours Worked',
+    type       => FIELD_TYPE_INTEGER,
+    buglist    => 1,
+    is_numeric => 1,
+  },
   {
     name       => 'percentage_complete',
     desc       => 'Percentage Complete',
+    type       => FIELD_TYPE_INTEGER,
     buglist    => 1,
     is_numeric => 1
   },
@@ -394,7 +480,12 @@ use constant DEFAULT_FIELDS => (
     type    => FIELD_TYPE_DATETIME
   },
   {name => 'comment_tag',  desc => 'Comment Tag'},
-  {name => 'triage_owner', desc => 'Triage Owner', buglist => 1},
+  {
+    name    => 'triage_owner',
+    desc    => 'Triage Owner',
+    type    => FIELD_TYPE_USER,
+    buglist => 1,
+  },
 );
 
 ################
diff --git a/extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl b/extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl
deleted file mode 100644 (file)
index acb6ab8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-[%# This Source Code Form is subject to the terms of the Mozilla Public
-  # License, v. 2.0. If a copy of the MPL was not distributed with this
-  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-  #
-  # This Source Code Form is "Incompatible With Secondary Licenses", as
-  # defined by the Mozilla Public License, v. 2.0.
-  #%]
-
-[%
-  constants.FIELD_TYPE_USER     = 20;
-  constants.FIELD_TYPE_USERS    = 21;
-  constants.FIELD_TYPE_BUG_LIST = 22;
-%]
index 3f514d5a0d49571a4978456b9cb4a79dfd523f8c..7bfada359004fdbb8d4c85696cc0aed9feda332f 100644 (file)
@@ -90,8 +90,11 @@ sub install_update_db {
 
   my $field = new Bugzilla::Field({name => 'restrict_comments'});
   if (!$field) {
-    Bugzilla::Field->create(
-      {name => 'restrict_comments', description => 'Restrict Comments'});
+    Bugzilla::Field->create({
+      name        => 'restrict_comments',
+      description => 'Restrict Comments',
+      type        => FIELD_TYPE_BOOLEAN,
+    });
   }
 
   $dbh->bz_add_column('bugs', 'restrict_comments', {TYPE => 'BOOLEAN'});
index 654063b9e1f93eb6ed364bbadd5b6c50cda2ff89..86977523fc8fbc75c93aa681d0a5a5cf8b581a47 100644 (file)
@@ -936,7 +936,10 @@ sub install_update_db {
   my $field = Bugzilla::Field->new({name => 'bug_mentor'});
   if (!$field) {
     Bugzilla::Field->create({
-      name => 'bug_mentor', description => 'Mentor', mailhead => 1
+      name        => 'bug_mentor',
+      description => 'Mentors',
+      type        => FIELD_TYPE_USERS,
+      mailhead    => 1,
     });
   }
   elsif (!$field->in_new_bugmail) {
index df1500364fe4c70d3835731ca26d0e18c9905728..f3819a83a7c29387a0d33c4640adff16332a0ada 100644 (file)
@@ -84,8 +84,12 @@ sub install_update_db {
 
   my $field = new Bugzilla::Field({name => 'votes'});
   if (!$field) {
-    Bugzilla::Field->create(
-      {name => 'votes', description => 'Votes', buglist => 1});
+    Bugzilla::Field->create({
+      name        => 'votes',
+      description => 'Votes',
+      type        => FIELD_TYPE_INTEGER,
+      buglist     => 1,
+    });
   }
 
   $dbh->bz_add_column('products', 'votesperuser',
index e458c6e4a640099b9fa4f06139916cdc3af23434..4ee255e4c81cef268c44788bd9dbea98b39223a4 100644 (file)
@@ -64,13 +64,19 @@ $stash->set(
     field_types => {
         Bugzilla::Constants::FIELD_TYPE_UNKNOWN()       => "Unknown Type",
         Bugzilla::Constants::FIELD_TYPE_FREETEXT()      => "Free Text",
-        Bugzilla::Constants::FIELD_TYPE_INTEGER()       => "Integer",
         Bugzilla::Constants::FIELD_TYPE_SINGLE_SELECT() => "Drop Down",
         Bugzilla::Constants::FIELD_TYPE_MULTI_SELECT()  => "Multiple-Selection Box",
         Bugzilla::Constants::FIELD_TYPE_TEXTAREA()      => "Large Text Box",
         Bugzilla::Constants::FIELD_TYPE_DATETIME()      => "Date/Time",
-        Bugzilla::Constants::FIELD_TYPE_DATE()          => "Date",
         Bugzilla::Constants::FIELD_TYPE_BUG_ID()        => "$terms->{Bug} ID",
+        Bugzilla::Constants::FIELD_TYPE_BUG_URLS()      => "$terms->{Bug} URL List",
+        Bugzilla::Constants::FIELD_TYPE_KEYWORDS()      => "Keywords",
+        Bugzilla::Constants::FIELD_TYPE_DATE()          => "Date",
+        Bugzilla::Constants::FIELD_TYPE_INTEGER()       => "Integer",
+        Bugzilla::Constants::FIELD_TYPE_BOOLEAN()       => "Boolean",
+        Bugzilla::Constants::FIELD_TYPE_USER()          => "User",
+        Bugzilla::Constants::FIELD_TYPE_USERS()         => "User List",
+        Bugzilla::Constants::FIELD_TYPE_BUG_LIST()      => "$terms->{Bug} ID List",
         Bugzilla::Constants::FIELD_TYPE_EXTENSION()     => "Extension",
     }
 );