Commit 85731f09 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 320866: Watching the same address twice produces software error - Patch by…

Bug 320866: Watching the same address twice produces software error - Patch by Frédéric Buclin <LpSolit@gmail.com> r=kevin r=bkor a=justdave
parent 4e89a5f6
...@@ -309,12 +309,12 @@ sub SaveEmail { ...@@ -309,12 +309,12 @@ sub SaveEmail {
# The new information given to us by the user. # The new information given to us by the user.
my @new_watch_names = split(/[,\s]+/, $cgi->param('watchedusers')); my @new_watch_names = split(/[,\s]+/, $cgi->param('watchedusers'));
my @new_watch_ids = (); my %new_watch_ids;
foreach my $username (@new_watch_names) { foreach my $username (@new_watch_names) {
my $watched_userid = DBNameToIdAndCheck(trim($username)); my $watched_userid = DBNameToIdAndCheck(trim($username));
push(@new_watch_ids, $watched_userid); $new_watch_ids{$watched_userid} = 1;
} }
my ($removed, $added) = diff_arrays($old_watch_ids, \@new_watch_ids); my ($removed, $added) = diff_arrays($old_watch_ids, [keys %new_watch_ids]);
# Remove people who were removed. # Remove people who were removed.
my $delete_sth = $dbh->prepare('DELETE FROM watch WHERE watched = ?' my $delete_sth = $dbh->prepare('DELETE FROM watch WHERE watched = ?'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment