diff options
author | mkanat%bugzilla.org <> | 2007-11-13 05:15:06 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-11-13 05:15:06 +0000 |
commit | 8db452b3d757978ff7166dc229bdb4ebfbd1bdc7 (patch) | |
tree | e57810082f11412d1a2d13118bb9c87e2a39804b /Bugzilla/Bug.pm | |
parent | d5adbc109d44481c9c4b7ba6429cbbc35487486e (diff) | |
download | bugs-8db452b3d757978ff7166dc229bdb4ebfbd1bdc7.tar bugs-8db452b3d757978ff7166dc229bdb4ebfbd1bdc7.tar.gz bugs-8db452b3d757978ff7166dc229bdb4ebfbd1bdc7.tar.bz2 bugs-8db452b3d757978ff7166dc229bdb4ebfbd1bdc7.tar.xz bugs-8db452b3d757978ff7166dc229bdb4ebfbd1bdc7.zip |
Bug 401957: Move comment "isprivate" updating from process_bug to Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-x | Bugzilla/Bug.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 7a4c02e89..e79a7a1ca 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -501,6 +501,12 @@ sub update { Bugzilla->user->id, $delta_ts); } } + + 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. + } # Insert the values into the multiselect value tables my @multi_selects = Bugzilla->get_fields( @@ -1339,6 +1345,19 @@ sub _set_global_validator { sub set_alias { $_[0]->set('alias', $_[1]); } sub set_cclist_accessible { $_[0]->set('cclist_accessible', $_[1]); } +sub set_comment_is_private { + my ($self, $comment_id, $isprivate) = @_; + return unless Bugzilla->user->is_insider; + my ($comment) = grep($comment_id eq $_->{id}, @{$self->longdescs}); + ThrowUserError('comment_invalid_isprivate', { id => $comment_id }) + if !$comment; + + $isprivate = $isprivate ? 1 : 0; + if ($isprivate != $comment->{isprivate}) { + $self->{comment_isprivate} ||= {}; + $self->{comment_isprivate}->{$comment_id} = $isprivate; + } +} sub set_component { my ($self, $name) = @_; my $old_comp = $self->component_obj; |