Fails on dupplicate email address instead of ignoring the INSERT

So you cannot add two times the same address, and you get an error
master
Daniel Berteaud 11 years ago
parent cdece954cf
commit 2953f9eb84
  1. 2
      public/vroom.pl

@ -354,7 +354,7 @@ helper add_notification => sub {
my ($room,$email) = @_; my ($room,$email) = @_;
my $data = $self->get_room($room); my $data = $self->get_room($room);
return undef unless ($data); return undef unless ($data);
my $sth = eval { $self->db->prepare("INSERT IGNORE INTO notifications (id,email) VALUES (?,?)") } || return undef; my $sth = eval { $self->db->prepare("INSERT INTO notifications (id,email) VALUES (?,?)") } || return undef;
$sth->execute($data->{id},$email) || return undef; $sth->execute($data->{id},$email) || return undef;
return 1; return 1;
}; };

Loading…
Cancel
Save