From 0565d657ea0021c160f9ec0806455e9ea7465dc9 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 3 Aug 2015 13:40:22 +0800 Subject: Bug 1190255 - modal UI is used immediately after bug creation, even if preferenced off --- extensions/BMO/Extension.pm | 3 ++- extensions/BugModal/Extension.pm | 11 +++++------ post_bug.cgi | 4 ++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 3fa547d7a..34e346a24 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -2203,8 +2203,9 @@ sub enter_bug_entrydefaultvars { my ($self, $args) = @_; my $vars = $args->{vars}; my $cgi = Bugzilla->cgi; + return unless my $format = $cgi->param('format'); - if ($cgi->param('format') eq 'fxos-feature') { + if ($format eq 'fxos-feature') { $vars->{feature_type} = $cgi->param('feature_type'); $vars->{description} = $cgi->param('description'); $vars->{discussion} = $cgi->param('discussion'); diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index 4926f7414..da582bae8 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -46,12 +46,12 @@ sub _alternative_show_bug_format { my $cgi = Bugzilla->cgi; my $user = Bugzilla->user; if (my $ctype = $cgi->param('ctype')) { - return undef if $ctype ne 'html'; + return '' if $ctype ne 'html'; } if (my $format = $cgi->param('format')) { - return ($format eq '__default__' || $format eq 'default') ? undef : $format; + return ($format eq '__default__' || $format eq 'default') ? '' : $format; } - return $user->setting('ui_experiments') eq 'on' ? 'modal' : undef; + return $user->setting('ui_experiments') eq 'on' ? 'modal' : ''; } sub template_after_create { @@ -157,7 +157,7 @@ sub template_before_process { || $file eq 'attachment/created.html.tmpl' || $file eq 'attachment/updated.html.tmpl') { - if (_alternative_show_bug_format()) { + if (_alternative_show_bug_format() eq 'modal') { $vars->{alt_ui_header} = 'bug_modal/header.html.tmpl'; $vars->{alt_ui_show} = 'bug/show-modal.html.tmpl'; $vars->{alt_ui_edit} = 'bug_modal/edit.html.tmpl'; @@ -167,8 +167,7 @@ sub template_before_process { return unless $file =~ m#^bug/show-([^\.]+)\.html\.tmpl$#; my $format = $1; - my $alt = _alternative_show_bug_format() // return; - return unless $alt eq $format; + return unless _alternative_show_bug_format() eq $format; return unless $vars->{bugs} diff --git a/post_bug.cgi b/post_bug.cgi index ecfb5fdaf..46596fddc 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -275,6 +275,10 @@ $vars->{sentmail} = \@all_mail_results; $format = $template->get_format("bug/create/created", scalar($cgi->param('created-format')), "html"); + +# don't leak the enter_bug format param to show_bug +$cgi->delete('format'); + print $cgi->header(); $template->process($format->{'template'}, $vars) || ThrowTemplateError($template->error()); -- cgit v1.2.3-24-g4f1b