@@ -116,6 +116,7 @@ our %api_field_types = (
116
116
);
117
117
118
118
our %api_field_names = reverse %{Bugzilla::Bug::FIELD_MAP()};
119
+
119
120
# This doesn't normally belong in FIELD_MAP, but we do want to translate
120
121
# "bug_group" back into "groups".
121
122
$api_field_names {' bug_group' } = ' groups' ;
@@ -171,7 +172,7 @@ sub fields {
171
172
foreach my $field (@fields ) {
172
173
my $visibility_field
173
174
= $field -> visibility_field ? $field -> visibility_field-> name : undef ;
174
- my $vis_values = $field -> visibility_values;
175
+ my $vis_values = $field -> visibility_values;
175
176
my $value_field = $field -> value_field ? $field -> value_field-> name : undef ;
176
177
177
178
my (@values , $has_values );
@@ -180,27 +181,27 @@ sub fields {
180
181
or $field -> name eq ' keywords' )
181
182
{
182
183
$has_values = 1;
183
- @values = @{$self -> _legal_field_values({field => $field })};
184
+ @values = @{$self -> _legal_field_values({field => $field })};
184
185
}
185
186
186
187
if (grep ($_ eq $field -> name, PRODUCT_SPECIFIC_FIELDS)) {
187
188
$value_field = ' product' ;
188
189
}
189
190
190
191
my %field_data = (
191
- id => $self -> type(' int' , $field -> id),
192
- type => $self -> type(' int' , $field -> type),
193
- is_custom => $self -> type(' boolean' , $field -> custom),
194
- name => $self -> type(' string' , $field -> name),
195
- display_name => $self -> type(' string' , $field -> description),
196
- is_mandatory => $self -> type(' boolean' , $field -> is_mandatory),
197
- is_on_bug_entry => $self -> type(' boolean' , $field -> enter_bug),
198
- visibility_field => $self -> type(' string' , $visibility_field ),
192
+ id => $self -> type(' int' , $field -> id),
193
+ type => $self -> type(' int' , $field -> type),
194
+ is_custom => $self -> type(' boolean' , $field -> custom),
195
+ name => $self -> type(' string' , $field -> name),
196
+ display_name => $self -> type(' string' , $field -> description),
197
+ is_mandatory => $self -> type(' boolean' , $field -> is_mandatory),
198
+ is_on_bug_entry => $self -> type(' boolean' , $field -> enter_bug),
199
+ visibility_field => $self -> type(' string' , $visibility_field ),
199
200
visibility_values => [map { $self -> type(' string' , $_ -> name) } @$vis_values ],
200
201
);
201
202
if ($has_values ) {
202
203
$field_data {value_field } = $self -> type(' string' , $value_field );
203
- $field_data {values } = \@values ;
204
+ $field_data {values } = \@values ;
204
205
}
205
206
push (@fields_out , filter $params , \%field_data );
206
207
}
@@ -318,8 +319,8 @@ sub comments {
318
319
{function => ' Bug.comments' , params => [' ids' , ' comment_ids' ]});
319
320
}
320
321
321
- my $bug_ids = $params -> {ids } || [];
322
- my $comment_ids = $params -> {comment_ids } || [];
322
+ my $bug_ids = $params -> {ids } || [];
323
+ my $comment_ids = $params -> {comment_ids } || [];
323
324
my $skip_private = $params -> {skip_private } ? 1 : 0;
324
325
325
326
my $dbh = Bugzilla-> switch_to_shadow_db();
@@ -330,6 +331,7 @@ sub comments {
330
331
}
331
332
332
333
if ($skip_private ) {
334
+
333
335
# Cache permissions for bugs. This highly reduces the number of calls to the DB.
334
336
# visible_bugs() is only able to handle bug IDs, so we have to skip aliases.
335
337
my @int = grep { $_ =~ / ^\d +$ / } @$bug_ids ;
@@ -343,7 +345,8 @@ sub comments {
343
345
if ($skip_private ) {
344
346
$bug = Bugzilla::Bug-> new({id => $bug_id , cache => 1});
345
347
next if $bug -> error || !$user -> can_see_bug($bug -> id);
346
- } else {
348
+ }
349
+ else {
347
350
$bug = Bugzilla::Bug-> check($bug_id );
348
351
}
349
352
@@ -362,7 +365,7 @@ sub comments {
362
365
363
366
my %comments ;
364
367
if (scalar @$comment_ids ) {
365
- my @ids = map { trim($_ ) } @$comment_ids ;
368
+ my @ids = map { trim($_ ) } @$comment_ids ;
366
369
my $comment_data = Bugzilla::Comment-> new_from_list(\@ids );
367
370
368
371
# See if we were passed any invalid comment ids.
@@ -501,6 +504,7 @@ sub history {
501
504
my $skip_private = $params -> {skip_private } ? 1 : 0;
502
505
503
506
if ($skip_private ) {
507
+
504
508
# Cache permissions for bugs. This highly reduces the number of calls to the DB.
505
509
# visible_bugs() is only able to handle bug IDs, so we have to skip aliases.
506
510
my @int = grep { $_ =~ / ^\d +$ / } @$ids ;
@@ -515,7 +519,8 @@ sub history {
515
519
if ($skip_private ) {
516
520
$bug = Bugzilla::Bug-> new({id => $bug_id , cache => 1});
517
521
next if $bug -> error || !$user -> can_see_bug($bug -> id);
518
- } else {
522
+ }
523
+ else {
519
524
$bug = Bugzilla::Bug-> check($bug_id );
520
525
}
521
526
@@ -586,7 +591,7 @@ sub search {
586
591
587
592
# Allow to search only in bug description (initial comment)
588
593
if (defined $match_params -> {description }) {
589
- $match_params -> {longdesc } = delete $match_params -> {description };
594
+ $match_params -> {longdesc } = delete $match_params -> {description };
590
595
$match_params -> {longdesc_initial } = 1;
591
596
}
592
597
@@ -595,7 +600,7 @@ sub search {
595
600
my %options = (fields => [' bug_id' ]);
596
601
597
602
# Find the highest custom field id
598
- my @field_ids = grep (/ ^f(\d +)$ / , keys %$match_params );
603
+ my @field_ids = grep (/ ^f(\d +)$ / , keys %$match_params );
599
604
my $last_field_id = @field_ids ? max @field_ids + 1 : 1;
600
605
601
606
# Do special search types for certain fields.
@@ -837,7 +842,7 @@ sub update {
837
842
838
843
my %changes = %{$all_changes {$bug -> id}};
839
844
foreach my $field (keys %changes ) {
840
- my $change = $changes {$field };
845
+ my $change = $changes {$field };
841
846
my $api_field = $api_field_names {$field } || $field ;
842
847
843
848
# We normalize undef to an empty string, so that the API
@@ -1194,10 +1199,9 @@ sub add_comment {
1194
1199
$bug -> add_comment(
1195
1200
$comment ,
1196
1201
{
1197
- isprivate => $params -> {is_private },
1198
- work_time => $params -> {work_time },
1199
- is_markdown =>
1200
- ( defined $params -> {is_markdown } ? $params -> {is_markdown } : 0 )
1202
+ isprivate => $params -> {is_private },
1203
+ work_time => $params -> {work_time },
1204
+ is_markdown => (defined $params -> {is_markdown } ? $params -> {is_markdown } : 0)
1201
1205
}
1202
1206
);
1203
1207
@@ -1481,7 +1485,7 @@ sub _bug_to_hash {
1481
1485
foreach my $attachment (@{$bug -> attachments}) {
1482
1486
next if $attachment -> isprivate && !$user -> is_insider;
1483
1487
push (@result ,
1484
- $self -> _attachment_to_hash($attachment , $params , [' extra' ], ' attachments' ));
1488
+ $self -> _attachment_to_hash($attachment , $params , [' extra' ], ' attachments' ));
1485
1489
}
1486
1490
$item {' attachments' } = \@result ;
1487
1491
}
@@ -1494,12 +1498,12 @@ sub _bug_to_hash {
1494
1498
}
1495
1499
if (filter_wants $params , ' comments' , [' extra' ]) {
1496
1500
my @result ;
1497
- my $comments
1498
- = $bug -> comments( {order => ' oldest_to_newest' , after => $params -> {new_since }});
1501
+ my $comments = $bug -> comments(
1502
+ {order => ' oldest_to_newest' , after => $params -> {new_since }});
1499
1503
foreach my $comment (@$comments ) {
1500
1504
next if $comment -> is_private && !$user -> is_insider;
1501
1505
push (@result ,
1502
- $self -> _translate_comment($comment , $params , [' extra' ], ' comments' ));
1506
+ $self -> _translate_comment($comment , $params , [' extra' ], ' comments' ));
1503
1507
}
1504
1508
$item {' comments' } = \@result ;
1505
1509
}
@@ -1528,7 +1532,8 @@ sub _bug_to_hash {
1528
1532
my $comment = Bugzilla::Comment-> match({bug_id => $bug -> id, LIMIT => 1})-> [0];
1529
1533
$item {' description' }
1530
1534
= ($comment && (!$comment -> is_private || Bugzilla-> user-> is_insider))
1531
- ? $comment -> body : ' ' ;
1535
+ ? $comment -> body
1536
+ : ' ' ;
1532
1537
}
1533
1538
if (filter_wants $params , ' dupe_of' ) {
1534
1539
$item {' dupe_of' } = $self -> type(' int' , $bug -> dup_id);
@@ -1549,7 +1554,7 @@ sub _bug_to_hash {
1549
1554
= Bugzilla::Bug::GetBugActivity($bug -> id, undef , $params -> {new_since }, 1);
1550
1555
foreach my $changeset (@$activity ) {
1551
1556
push (@result ,
1552
- $self -> _changeset_to_hash($changeset , $params , [' extra' ], ' history' ));
1557
+ $self -> _changeset_to_hash($changeset , $params , [' extra' ], ' history' ));
1553
1558
}
1554
1559
$item {' history' } = \@result ;
1555
1560
}
@@ -1760,14 +1765,14 @@ sub _changeset_to_hash {
1760
1765
my $attach_id = delete $change -> {attachid };
1761
1766
my $comment = delete $change -> {comment };
1762
1767
1763
- $change -> {field_name } = $self -> type(' string' , $api_field_name );
1764
- $change -> {removed } = $self -> type($api_field_type , $change -> {removed });
1765
- $change -> {added } = $self -> type($api_field_type , $change -> {added });
1768
+ $change -> {field_name } = $self -> type(' string' , $api_field_name );
1769
+ $change -> {removed } = $self -> type($api_field_type , $change -> {removed });
1770
+ $change -> {added } = $self -> type($api_field_type , $change -> {added });
1766
1771
$change -> {attachment_id } = $self -> type(' int' , $attach_id ) if $attach_id ;
1767
1772
$change -> {comment_id } = $self -> type(' int' , $comment -> id) if $comment ;
1768
1773
$change -> {comment_count } = $self -> type(' int' , $comment -> count) if $comment ;
1769
1774
1770
- push (@{$item -> {changes }}, $change );
1775
+ push (@{$item -> {changes }}, $change );
1771
1776
}
1772
1777
1773
1778
return filter($filters , $item , $types , $prefix );
0 commit comments