From 3eec411a147f1e69507f06bf3468f897fef2c7e0 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 3 Sep 2015 12:18:13 +0800 Subject: Bug 1200961 - switching to the modal view doesn't force the mozilla skin --- extensions/BugModal/Extension.pm | 21 +++++++++++++++++++-- userprefs.cgi | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index da582bae8..54ef8f4ca 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -24,10 +24,10 @@ use Template::Stash; our $VERSION = '1'; # force skin to mozilla -sub setting_set_value { +sub settings_after_update { my ($self, $args) = @_; - return unless $args->{setting} eq 'ui_experiments' && $args->{value} ne 'on'; my $settings = Bugzilla->user->settings; + return unless $settings->{ui_experiments}->{value} eq 'on'; return if $settings->{skin}->{value} =~ /^Mozilla/; $settings->{skin}->set('Mozilla'); } @@ -293,6 +293,23 @@ sub webservice { sub install_before_final_checks { my ($self, $args) = @_; add_setting('ui_experiments', ['on', 'off'], 'off'); + + # ensure the correct skin is being used + my $dbh = Bugzilla->dbh; + my $users = $dbh->selectcol_arrayref(" + SELECT + ui.user_id + FROM + profile_setting ui + LEFT JOIN profile_setting skin ON skin.user_id = ui.user_id AND skin.setting_name = 'skin' + WHERE + ui.setting_name = 'ui_experiments' + AND ui.setting_value = 'on' + AND skin.setting_value NOT LIKE 'Mozilla%' + "); + foreach my $user_id (@$users) { + Bugzilla::User->new($user_id)->settings->{skin}->set('Mozilla'); + } } __PACKAGE__->NAME; diff --git a/userprefs.cgi b/userprefs.cgi index 9ec152538..9b86f010c 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -209,6 +209,9 @@ sub SaveSettings { $settings->{$name}->set($value); } } + + Bugzilla::Hook::process('settings_after_update'); + $vars->{'settings'} = $user->settings(1); clear_settings_cache($user->id); } -- cgit v1.2.3-24-g4f1b