summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2014-02-25 07:31:55 +0100
committerByron Jones <bjones@mozilla.com>2014-02-25 07:31:55 +0100
commitab86aba0236ca96d58d75b839c003f093a12a297 (patch)
tree5b672f901931cce0dc02c402f2bb5c08e20d27d4 /Bugzilla
parent0e67941defa509229a33b3b20d2ff2660f8728cb (diff)
downloadbugzilla-ab86aba0236ca96d58d75b839c003f093a12a297.tar.gz
bugzilla-ab86aba0236ca96d58d75b839c003f093a12a297.tar.xz
Bug 975943: add special support for a "deleted" comment tag
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm3
-rw-r--r--Bugzilla/Comment.pm27
2 files changed, 17 insertions, 13 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 6a5e0966e..295befa9c 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -3463,8 +3463,9 @@ sub comments {
$comment->{count} = $count++;
$comment->{bug} = $self;
}
+ Bugzilla::Hook::process('bug_comments', { bug => $self, comments => $self->{'comments'} });
# Some bugs may have no comments when upgrading old installations.
- Bugzilla::Comment->preload($self->{'comments'}) if $count;
+ Bugzilla::Comment->preload($self->{'comments'}) if @{ $self->{'comments'} };
}
return unless defined wantarray;
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm
index 623796142..30f0252b3 100644
--- a/Bugzilla/Comment.pm
+++ b/Bugzilla/Comment.pm
@@ -29,6 +29,7 @@ use Bugzilla::Attachment;
use Bugzilla::Comment::TagWeights;
use Bugzilla::Constants;
use Bugzilla::Error;
+use Bugzilla::Hook;
use Bugzilla::User;
use Bugzilla::Util;
@@ -165,18 +166,16 @@ sub preload {
$comment->{author} = $user_map{$comment->{who}};
}
# Tags
- if (Bugzilla->params->{'comment_taggers_group'}) {
- my $dbh = Bugzilla->dbh;
- my @comment_ids = map { $_->id } @$comments;
- my %comment_map = map { $_->id => $_ } @$comments;
- my $rows = $dbh->selectall_arrayref(
- "SELECT comment_id, " . $dbh->sql_group_concat('tag', "','") . "
- FROM longdescs_tags
- WHERE " . $dbh->sql_in('comment_id', \@comment_ids) . "
- GROUP BY comment_id");
- foreach my $row (@$rows) {
- $comment_map{$row->[0]}->{tags} = [ split(/,/, $row->[1]) ];
- }
+ my $dbh = Bugzilla->dbh;
+ my @comment_ids = map { $_->id } @$comments;
+ my %comment_map = map { $_->id => $_ } @$comments;
+ my $rows = $dbh->selectall_arrayref(
+ "SELECT comment_id, " . $dbh->sql_group_concat('tag', "','") . "
+ FROM longdescs_tags
+ WHERE " . $dbh->sql_in('comment_id', \@comment_ids) . "
+ GROUP BY comment_id");
+ foreach my $row (@$rows) {
+ $comment_map{$row->[0]}->{tags} = [ split(/,/, $row->[1]) ];
}
}
@@ -294,6 +293,8 @@ sub add_tag {
return if grep { lc($tag) eq lc($_) } @$tags;
push @$tags, $tag;
$self->{'tags'} = [ sort @$tags ];
+ Bugzilla::Hook::process("comment_after_add_tag",
+ { comment => $self, tag => $tag });
}
sub remove_tag {
@@ -304,6 +305,8 @@ sub remove_tag {
my $index = first { lc($tags->[$_]) eq lc($tag) } 0..scalar(@$tags) - 1;
return unless defined $index;
splice(@$tags, $index, 1);
+ Bugzilla::Hook::process("comment_after_remove_tag",
+ { comment => $self, tag => $tag });
}
##############