Bugzilla->user->id, $delta_ts);
}
}
-
+
+ # Comment Privacy
foreach my $comment_id (keys %{$self->{comment_isprivate} || {}}) {
$dbh->do("UPDATE longdescs SET isprivate = ? WHERE comment_id = ?",
undef, $self->{comment_isprivate}->{$comment_id}, $comment_id);
- # XXX It'd be nice to track this in the bug activity.
+ my ($from, $to)
+ = $self->{comment_isprivate}->{$comment_id} ? (0, 1) : (1, 0);
+ LogActivityEntry($self->id, "longdescs.isprivate", $from, $to,
+ Bugzilla->user->id, $delta_ts, $comment_id);
}
# Insert the values into the multiselect value tables
my $query = "SELECT fielddefs.name, bugs_activity.attach_id, " .
$dbh->sql_date_format('bugs_activity.bug_when', '%Y.%m.%d %H:%i:%s') .
- ", bugs_activity.removed, bugs_activity.added, profiles.login_name
+ ", bugs_activity.removed, bugs_activity.added, profiles.login_name,
+ bugs_activity.comment_id
FROM bugs_activity
$suppjoins
LEFT JOIN fielddefs
my $incomplete_data = 0;
foreach my $entry (@$list) {
- my ($fieldname, $attachid, $when, $removed, $added, $who) = @$entry;
+ my ($fieldname, $attachid, $when, $removed, $added, $who, $comment_id) = @$entry;
my %change;
my $activity_visible = 1;
|| $fieldname eq 'deadline')
{
$activity_visible = Bugzilla->user->is_timetracker;
- } else {
+ }
+ elsif ($fieldname eq 'longdescs.isprivate'
+ && !Bugzilla->user->is_insider
+ && $added)
+ {
+ $activity_visible = 0;
+ }
+ else {
$activity_visible = 1;
}
$change{'attachid'} = $attachid;
$change{'removed'} = $removed;
$change{'added'} = $added;
+
+ if ($comment_id) {
+ $change{'comment'} = Bugzilla::Comment->new($comment_id);
+ }
+
push (@$changes, \%change);
}
}
# Update the bugs_activity table to reflect changes made in bugs.
sub LogActivityEntry {
- my ($i, $col, $removed, $added, $whoid, $timestamp) = @_;
+ my ($i, $col, $removed, $added, $whoid, $timestamp, $comment_id) = @_;
my $dbh = Bugzilla->dbh;
# in the case of CCs, deps, and keywords, there's a possibility that someone
# might try to add or remove a lot of them at once, which might take more
trick_taint($removestr);
my $fieldid = get_field_id($col);
$dbh->do("INSERT INTO bugs_activity
- (bug_id, who, bug_when, fieldid, removed, added)
- VALUES (?, ?, ?, ?, ?, ?)",
- undef, ($i, $whoid, $timestamp, $fieldid, $removestr, $addstr));
+ (bug_id, who, bug_when, fieldid, removed, added, comment_id)
+ VALUES (?, ?, ?, ?, ?, ?, ?)",
+ undef, ($i, $whoid, $timestamp, $fieldid, $removestr, $addstr, $comment_id));
}
}
my $diffs = $dbh->selectall_arrayref(
"SELECT profiles.login_name, profiles.realname, fielddefs.description,
bugs_activity.bug_when, bugs_activity.removed,
- bugs_activity.added, bugs_activity.attach_id, fielddefs.name
+ bugs_activity.added, bugs_activity.attach_id, fielddefs.name,
+ bugs_activity.comment_id
FROM bugs_activity
INNER JOIN fielddefs
ON fielddefs.id = bugs_activity.fieldid
my $fullwho;
my @changedfields;
foreach my $ref (@$diffs) {
- my ($who, $whoname, $what, $when, $old, $new, $attachid, $fieldname) = (@$ref);
+ my ($who, $whoname, $what, $when, $old, $new, $attachid, $fieldname, $comment_id) = (@$ref);
my $diffpart = {};
if ($who ne $lastwho) {
$lastwho = $who;
'SELECT isprivate FROM attachments WHERE attach_id = ?',
undef, ($attachid));
}
+ if ($fieldname eq 'longdescs.isprivate') {
+ my $comment = Bugzilla::Comment->new($comment_id);
+ my $comment_num = $comment->count;
+ $what =~ s/^(Comment )?/Comment #$comment_num /;
+ $diffpart->{'isprivate'} = $new;
+ }
$difftext = three_columns($what, $old, $new);
$diffpart->{'header'} = $diffheader;
$diffpart->{'fieldname'} = $fieldname;