summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-02-05 10:24:44 +0100
committerYorhel <git@yorhel.nl>2010-02-05 10:24:44 +0100
commitb541d72849cd859580e7e6d7232165c92aa3a40b (patch)
tree2a6d3c47b4679387d89488fcd23ec9833c963155 /lib
parent004d60b64d80506944fd069c89c589302b5ae313 (diff)
Notifications: Added 'announce' notification
This one is also configurable, but mainly because I want to avoid generating several thousands of notifications for a single action...
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Users.pm4
-rw-r--r--lib/VNDB/Handler/Users.pm19
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm
index 20278688..41f9f25a 100644
--- a/lib/VNDB/DB/Users.pm
+++ b/lib/VNDB/DB/Users.pm
@@ -54,7 +54,7 @@ sub dbUserGet {
qw|id username c_votes c_changes show_list c_tags|,
q|extract('epoch' from registered) as registered|,
$o{what} =~ /extended/ ? (
- qw|mail rank salt skin customcss show_nsfw ign_votes notify_dbedit|,
+ qw|mail rank salt skin customcss show_nsfw ign_votes notify_dbedit notify_announce|,
q|encode(passwd, 'hex') AS passwd|
) : (),
$o{what} =~ /notifycount/ ?
@@ -100,7 +100,7 @@ sub dbUserEdit {
my %h;
defined $o{$_} && ($h{$_.' = ?'} = $o{$_})
- for (qw| username mail rank show_nsfw show_list skin customcss salt ign_votes notify_dbedit |);
+ for (qw| username mail rank show_nsfw show_list skin customcss salt ign_votes notify_dbedit notify_announce |);
$h{'passwd = decode(?, \'hex\')'} = $o{passwd}
if defined $o{passwd};
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index e7822f6e..f68f9db9 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -537,11 +537,14 @@ sub notifies {
my $saved;
if($self->reqMethod() eq 'POST' && $self->reqParam('set')) {
my $frm = $self->formValidate(
- { name => 'notify_dbedit', required => 0 }
+ { name => 'notify_dbedit', required => 0 },
+ { name => 'notify_announce', required => 0 }
);
return 404 if $frm->{_err};
- $frm->{notify_dbedit} = $frm->{notify_dbedit} ? 1 : 0;
- $self->authInfo->{notify_dbedit} = $frm->{notify_dbedit};
+ for ('notify_dbedit', 'notify_announce') {
+ $frm->{$_} = $frm->{$_} ? 1 : 0;
+ $self->authInfo->{$_} = $frm->{$_};
+ }
$self->dbUserEdit($uid, %$frm);
$saved = 1;
@@ -628,10 +631,12 @@ sub notifies {
h1 mt '_usern_set_title';
div class => 'notice', mt '_usern_set_saved' if $saved;
p;
- input type => 'checkbox', name => 'notify_dbedit', id => 'notify_dbedit', value => 1,
- $self->authInfo->{notify_dbedit} ? (checked => 'checked') : ();
- label for => 'notify_dbedit', ' '.mt('_usern_set_dbedit');
- br;
+ for('dbedit', 'announce') {
+ input type => 'checkbox', name => "notify_$_", id => "notify_$_", value => 1,
+ $self->authInfo->{"notify_$_"} ? (checked => 'checked') : ();
+ label for => "notify_$_", ' '.mt("_usern_set_$_");
+ br;
+ }
input type => 'submit', name => 'set', value => mt '_usern_set_submit';
end;
end;