]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 616192: Display personal tags in buglists
authorFrédéric Buclin <LpSolit@gmail.com>
Sat, 14 Apr 2012 17:45:05 +0000 (19:45 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Sat, 14 Apr 2012 17:45:05 +0000 (19:45 +0200)
r=timello a=LpSolit

Bugzilla/Field.pm
Bugzilla/Search.pm

index 12ef0c54f9111bed7f9e996ed150ccaa6098eebc..4ec592164aa7bb7c74002820c10d57247d06c3c3 100644 (file)
@@ -248,7 +248,7 @@ use constant DEFAULT_FIELDS => (
     {name => "owner_idle_time",       desc => "Time Since Assignee Touched"},
     {name => 'see_also',              desc => "See Also",
      type => FIELD_TYPE_BUG_URLS},
-    {name => 'tag',                   desc => 'Tags'},
+    {name => 'tag',                   desc => 'Tags', buglist => 1},
 );
 
 ################
index 5c1a8c7ba0c2f571c15a8770bf23e7aa5ed1c811..7f9bec9de5743ed60645e183eafd0b0ee23682d2 100644 (file)
@@ -397,71 +397,88 @@ use constant COLUMN_DEPENDS => {
 # certain columns in the buglist. For the most part, Search.pm uses
 # DB::Schema to figure out what needs to be joined, but for some
 # fields it needs a little help.
-use constant COLUMN_JOINS => {
-    actual_time => {
-        table => '(SELECT bug_id, SUM(work_time) AS total'
-                 . ' FROM longdescs GROUP BY bug_id)',
-        join  => 'INNER',
-    },
-    assigned_to => {
-        from  => 'assigned_to',
-        to    => 'userid',
-        table => 'profiles',
-        join  => 'INNER',
-    },
-    reporter => {
-        from  => 'reporter',
-        to    => 'userid',
-        table => 'profiles',
-        join  => 'INNER',
-    },
-    qa_contact => {
-        from  => 'qa_contact',
-        to    => 'userid',
-        table => 'profiles',
-    },
-    component => {
-        from  => 'component_id',
-        to    => 'id',
-        table => 'components',
-        join  => 'INNER',
-    },
-    product => {
-        from  => 'product_id',
-        to    => 'id',
-        table => 'products',
-        join  => 'INNER',
-    },
-    classification => {
-        table => 'classifications',
-        from  => 'map_product.classification_id',
-        to    => 'id',
-        join  => 'INNER',
-    },
-    'flagtypes.name' => {
-        as    => 'map_flags',
-        table => 'flags',
-        extra => ['map_flags.attach_id IS NULL'],
-        then_to => {
-            as    => 'map_flagtypes',
-            table => 'flagtypes',
-            from  => 'map_flags.type_id',
+sub COLUMN_JOINS {
+    my $invocant = shift;
+    my $user = blessed($invocant) ? $invocant->_user : Bugzilla->user;
+
+    my $joins = {
+        actual_time => {
+            table => '(SELECT bug_id, SUM(work_time) AS total'
+                     . ' FROM longdescs GROUP BY bug_id)',
+            join  => 'INNER',
+        },
+        assigned_to => {
+            from  => 'assigned_to',
+            to    => 'userid',
+            table => 'profiles',
+            join  => 'INNER',
+        },
+        reporter => {
+            from  => 'reporter',
+            to    => 'userid',
+            table => 'profiles',
+            join  => 'INNER',
+        },
+        qa_contact => {
+            from  => 'qa_contact',
+            to    => 'userid',
+            table => 'profiles',
+        },
+        component => {
+            from  => 'component_id',
             to    => 'id',
+            table => 'components',
+            join  => 'INNER',
         },
-    },
-    keywords => {
-        table => 'keywords',
-        then_to => {
-            as    => 'map_keyworddefs',
-            table => 'keyworddefs',
-            from  => 'map_keywords.keywordid',
+        product => {
+            from  => 'product_id',
             to    => 'id',
+            table => 'products',
+            join  => 'INNER',
         },
-    },
-    'longdescs.count' => {
-        table => 'longdescs',
-        join  => 'INNER',
-    },
+        classification => {
+            table => 'classifications',
+            from  => 'map_product.classification_id',
+            to    => 'id',
+            join  => 'INNER',
+        },
+        'flagtypes.name' => {
+            as    => 'map_flags',
+            table => 'flags',
+            extra => ['map_flags.attach_id IS NULL'],
+            then_to => {
+                as    => 'map_flagtypes',
+                table => 'flagtypes',
+                from  => 'map_flags.type_id',
+                to    => 'id',
+            },
+        },
+        keywords => {
+            table => 'keywords',
+            then_to => {
+                as    => 'map_keyworddefs',
+                table => 'keyworddefs',
+                from  => 'map_keywords.keywordid',
+                to    => 'id',
+            },
+        },
+        'longdescs.count' => {
+            table => 'longdescs',
+            join  => 'INNER',
+        },
+        tag => {
+            as => 'map_bug_tag',
+            table => 'bug_tag',
+            then_to => {
+                as => 'map_tag',
+                table => 'tag',
+                extra => ['map_tag.user_id = ' . $user->id],
+                from => 'map_bug_tag.tag_id',
+                to => 'id',
+            },
+        }
+    };
+    return $joins;
 };
 
 # This constant defines the columns that can be selected in a query 
@@ -527,6 +544,8 @@ sub COLUMNS {
         'keywords' => $dbh->sql_group_concat('DISTINCT map_keyworddefs.name'),
         
         'longdescs.count' => 'COUNT(DISTINCT map_longdescs_count.comment_id)',
+
+        tag => $dbh->sql_group_concat($dbh->sql_string_concat('map_tag.name')),
     );
 
     # Backward-compatibility for old field names. Goes new_name => old_name.
@@ -1816,7 +1835,7 @@ sub _get_column_joins {
 
     return $cache->{column_joins} if defined $cache->{column_joins};
 
-    my %column_joins = %{ COLUMN_JOINS() };
+    my %column_joins = %{ $self->COLUMN_JOINS() };
     Bugzilla::Hook::process('buglist_column_joins',
                             { column_joins => \%column_joins });