summaryrefslogtreecommitdiffstats
path: root/userprefs.cgi
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-10-21 05:00:37 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-10-21 05:00:37 +0200
commitc8cf2b58bae632b6801337971323d37cf9f5a0f0 (patch)
tree9825f8b4c9ace9343678595c3a6cbe14ce9bb6e9 /userprefs.cgi
parentd1b6f1d78bdcde363cbcc80c4e589742819a4e24 (diff)
downloadbugzilla-c8cf2b58bae632b6801337971323d37cf9f5a0f0.tar.gz
bugzilla-c8cf2b58bae632b6801337971323d37cf9f5a0f0.tar.xz
Bug 1209599 - group general preferences by category
Diffstat (limited to 'userprefs.cgi')
-rwxr-xr-xuserprefs.cgi27
1 files changed, 13 insertions, 14 deletions
diff --git a/userprefs.cgi b/userprefs.cgi
index bd1bb8ab7..3f5d2038c 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -228,21 +228,20 @@ sub DisableAccount {
sub DoSettings {
my $user = Bugzilla->user;
- my $settings = $user->settings;
- $vars->{'settings'} = $settings;
-
- my @setting_list = sort keys %$settings;
- $vars->{'setting_names'} = \@setting_list;
-
- $vars->{'has_settings_enabled'} = 0;
- # Is there at least one user setting enabled?
- foreach my $setting_name (@setting_list) {
- if ($settings->{"$setting_name"}->{'is_enabled'}) {
- $vars->{'has_settings_enabled'} = 1;
- last;
- }
+ my %settings;
+ my $has_settings_enabled = 0;
+ foreach my $name (sort keys %{ $user->settings }) {
+ my $setting = $user->settings->{$name};
+ next if !$setting->{is_enabled};
+ my $category = $setting->{category};
+ $settings{$category} ||= [];
+ push(@{ $settings{$category} }, $setting);
+ $has_settings_enabled = 1 if $setting->{is_enabled};
}
- $vars->{'dont_show_button'} = !$vars->{'has_settings_enabled'};
+
+ $vars->{settings} = \%settings;
+ $vars->{has_settings_enabled} = $has_settings_enabled;
+ $vars->{dont_show_button} = !$has_settings_enabled;
}
sub SaveSettings {