summaryrefslogtreecommitdiffstats
path: root/userprefs.cgi
diff options
context:
space:
mode:
authormyk%mozilla.org <>2002-03-01 22:59:59 +0100
committermyk%mozilla.org <>2002-03-01 22:59:59 +0100
commit840a878b8bac93072bbe8836f04a65902ed49a67 (patch)
tree78d2f5cb7a12bb90d1e85b940dd8cd1b9258d9eb /userprefs.cgi
parent8e855f2dcd3f80aa2a1f4d17ba46f96eae05b99e (diff)
downloadbugzilla-840a878b8bac93072bbe8836f04a65902ed49a67.tar.gz
bugzilla-840a878b8bac93072bbe8836f04a65902ed49a67.tar.xz
Fix for bug 128437: correctly display default values for new preferences on the "email preferences" tab.
Fix by Myk Melez <myk@mozilla.org>. r=jake,justdave
Diffstat (limited to 'userprefs.cgi')
-rwxr-xr-xuserprefs.cgi45
1 files changed, 25 insertions, 20 deletions
diff --git a/userprefs.cgi b/userprefs.cgi
index fbac113a0..301b90b1e 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -141,28 +141,33 @@ sub DoEmail {
# warnings. Any suitably large number would do.
my %emailflags = split(/~/, $flagstring, 255);
- $vars->{'excludeself'} = 0;
-
+ # Determine the value of the "excludeself" global email preference.
+ # Note that the value of "excludeself" is assumed to be off if the
+ # preference does not exist in the user's list, unlike other
+ # preferences whose value is assumed to be on if they do not exist.
+ if (exists($emailflags{'excludeself'})
+ && $emailflags{'excludeself'} eq 'on')
+ {
+ $vars->{'excludeself'} = 1;
+ }
+ else {
+ $vars->{'excludeself'} = 0;
+ }
+
# Parse the info into a hash of hashes; the first hash keyed by role,
- # the second by reason, and the value being 1 or 0 (undef).
- foreach my $key (keys %emailflags) {
- # ExcludeSelf is special.
- if ($key eq 'ExcludeSelf' && $emailflags{$key} eq 'on') {
- $vars->{'excludeself'} = 1;
- next;
- }
-
- # All other keys match this regexp.
- $key =~ /email([A-Z]+[a-z]+)([A-Z]+[a-z]*)/;
-
- # Create a new hash if we don't have one...
- if (!defined($vars->{$1})) {
- $vars->{$1} = {};
+ # the second by reason, and the value being 1 or 0 for (on or off).
+ # Preferences not existing in the user's list are assumed to be on.
+ foreach my $role (@roles) {
+ $vars->{$role} = {};
+ foreach my $reason (@reasons) {
+ my $key = "email$role$reason";
+ if (!exists($emailflags{$key}) || $emailflags{$key} eq 'on') {
+ $vars->{$role}{$reason} = 1;
+ }
+ else {
+ $vars->{$role}{$reason} = 0;
+ }
}
-
- if ($emailflags{$key} eq "on") {
- $vars->{$1}{$2} = 1;
- }
}
}