Fix WebService.Bug.add_comment

i18n
Vitaliy Filippov 2017-04-24 15:16:14 +03:00
parent e08c5f3a6b
commit 917f3e1566
2 changed files with 12 additions and 4 deletions

View File

@ -476,6 +476,8 @@ sub create
sub update
{
my $self = shift;
my ($additional_changes) = @_;
$self->make_dirty;
my $method = $self->id ? 'update' : 'create';
@ -618,6 +620,10 @@ sub update
$self->prepare_mail_results($changes);
# Remove obsolete internal variables.
if ($additional_changes)
{
$additional_changes->{added_comments} = $self->{added_comments};
}
delete $self->{_old_self};
delete $self->{added_comments};
delete $self->{edited_comments};
@ -1499,7 +1505,7 @@ sub save_dup_id
sub save_added_comments
{
my ($self, $changes) = @_;
my $dbh = Bugzilla->dbh;
delete $self->{comments} if @{$self->{added_comments} || []};
foreach my $comment (@{$self->{added_comments} || []})
{
@ -1515,7 +1521,8 @@ sub save_added_comments
$comment->{bug_when} = $self->{delta_ts} if !$comment->{bug_when} || $comment->{bug_when} gt $self->{delta_ts};
my $columns = join(',', keys %$comment);
my $qmarks = join(',', ('?') x keys %$comment);
Bugzilla->dbh->do("INSERT INTO longdescs ($columns) VALUES ($qmarks)", undef, values %$comment);
$dbh->do("INSERT INTO longdescs ($columns) VALUES ($qmarks)", undef, values %$comment);
$comment->{id} = $dbh->bz_last_key('longdescs', 'id');
if (0+$comment->{work_time} != 0)
{
# Log worktime

View File

@ -977,11 +977,12 @@ sub add_comment {
$params->{is_private} = delete $params->{private};
}
# Append comment
my $info = {};
$bug->add_comment($comment, { isprivate => $params->{is_private},
work_time => $params->{work_time} });
$bug->update();
$bug->update($info);
my $new_comment_id = $bug->{added_comments}[0]->id;
my $new_comment_id = $info->{added_comments}->[0]->{id};
# Send mail.
Bugzilla::BugMail::Send($bug->bug_id, { changer => $user });