diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/DB/Users.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Handler/Users.pm | 29 |
2 files changed, 30 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index bade6ca1..20278688 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|, + qw|mail rank salt skin customcss show_nsfw ign_votes notify_dbedit|, 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 |); + for (qw| username mail rank show_nsfw show_list skin customcss salt ign_votes notify_dbedit |); $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 13d4c55e..e7822f6e 100644 --- a/lib/VNDB/Handler/Users.pm +++ b/lib/VNDB/Handler/Users.pm @@ -533,7 +533,20 @@ sub notifies { ); return 404 if $f->{_err}; - if($self->reqMethod() eq 'POST') { + # changing the notification settings + my $saved; + if($self->reqMethod() eq 'POST' && $self->reqParam('set')) { + my $frm = $self->formValidate( + { name => 'notify_dbedit', required => 0 } + ); + return 404 if $frm->{_err}; + $frm->{notify_dbedit} = $frm->{notify_dbedit} ? 1 : 0; + $self->authInfo->{notify_dbedit} = $frm->{notify_dbedit}; + $self->dbUserEdit($uid, %$frm); + $saved = 1; + + # updating notifications + } elsif($self->reqMethod() eq 'POST') { my $frm = $self->formValidate( { name => 'notifysel', multi => 1, required => 0, template => 'int' }, { name => 'markread', required => 0 }, @@ -609,6 +622,20 @@ sub notifies { ); end; } + + form method => 'post', action => "/u$uid/notifies"; + div class => 'mainbox'; + 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; + input type => 'submit', name => 'set', value => mt '_usern_set_submit'; + end; + end; + end; $self->htmlFooter; } |