diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-09-04 18:25:24 -0400 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-09-04 18:25:24 -0400 |
commit | bcbdb84677b662d2172a0a1ec4d206bd4f694c51 (patch) | |
tree | 86e1e19e03529c67fe5e1512651a1396a2f2116c /process_bug.cgi | |
parent | 3e336837512e9436658cbed6aa239d2019569c6f (diff) | |
download | bugs-bcbdb84677b662d2172a0a1ec4d206bd4f694c51.tar bugs-bcbdb84677b662d2172a0a1ec4d206bd4f694c51.tar.gz bugs-bcbdb84677b662d2172a0a1ec4d206bd4f694c51.tar.bz2 bugs-bcbdb84677b662d2172a0a1ec4d206bd4f694c51.tar.xz bugs-bcbdb84677b662d2172a0a1ec4d206bd4f694c51.zip |
Bug 69447 - Make CC changes not cause midairs.
r/a=LpSolit
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-x | process_bug.cgi | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/process_bug.cgi b/process_bug.cgi index d9ae9c109..05c882ed8 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -118,23 +118,43 @@ if (defined $cgi->param('delta_ts')) if ($first_delta_tz_z ne $delta_ts_z) { ($vars->{'operations'}) = $first_bug->get_activity(undef, $cgi->param('delta_ts')); - $vars->{'title_tag'} = "mid_air"; - ThrowCodeError('undefined_field', { field => 'longdesclength' }) if !defined $cgi->param('longdesclength'); - $vars->{'start_at'} = $cgi->param('longdesclength'); + my $start_at = $cgi->param('longdesclength'); + # Always sort midair collision comments oldest to newest, # regardless of the user's personal preference. - $vars->{'comments'} = $first_bug->comments({ order => "oldest_to_newest" }); - $vars->{'bug'} = $first_bug; + my $comments = $first_bug->comments({ order => "oldest_to_newest" }); # The token contains the old delta_ts. We need a new one. $cgi->param('token', issue_hash_token([$first_bug->id, $first_bug->delta_ts])); - # Warn the user about the mid-air collision and ask them what to do. - $template->process("bug/process/midair.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + + # Show midair if previous changes made other than CC + # and/or one or more comments were made + my $do_midair = scalar @$comments > $start_at ? 1 : 0; + + if (!$do_midair) { + foreach my $operation (@{ $vars->{'operations'} }) { + foreach my $change (@{ $operation->{'changes'} }) { + $do_midair = 1 if $change->{'fieldname'} ne 'cc'; + last; + } + last if $do_midair; + } + } + + if ($do_midair) { + $vars->{'title_tag'} = "mid_air"; + $vars->{'start_at'} = $start_at; + $vars->{'comments'} = $comments; + $vars->{'bug'} = $first_bug; + + # Warn the user about the mid-air collision and ask them what to do. + $template->process("bug/process/midair.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; + } } } |