summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-07-09 12:57:41 +0200
committerYorhel <git@yorhel.nl>2020-07-09 12:57:41 +0200
commit9215c6eb5a0128a94a8511aeb72c0f95ab9f99fd (patch)
tree2791c99513cebff84bb50a5a9385619522fddf3c /lib
parent73eb6385240d82424d13235f02822920f51e974b (diff)
User::Edit: Remove "show_nsfw" setting from profile + deprecate NSFW flags
Diffstat (limited to 'lib')
-rw-r--r--lib/VNWeb/Auth.pm2
-rw-r--r--lib/VNWeb/User/Edit.pm5
-rw-r--r--lib/VNWeb/Validation.pm2
3 files changed, 4 insertions, 5 deletions
diff --git a/lib/VNWeb/Auth.pm b/lib/VNWeb/Auth.pm
index d93faa33..6e4d68c0 100644
--- a/lib/VNWeb/Auth.pm
+++ b/lib/VNWeb/Auth.pm
@@ -260,7 +260,7 @@ sub csrfcheck {
# TODO: Measure global usage of the pref() and prefSet() calls to see if this cache is actually necessary.
my @pref_columns = qw/
- email_confirmed skin customcss filter_vn filter_release show_nsfw notify_dbedit notify_announce
+ email_confirmed skin customcss filter_vn filter_release notify_dbedit notify_announce
vn_list_own vn_list_wish tags_all tags_cont tags_ero tags_tech spoilers traits_sexual
max_sexual max_violence nodistract_can nodistract_noads nodistract_nofancy
/;
diff --git a/lib/VNWeb/User/Edit.pm b/lib/VNWeb/User/Edit.pm
index e4cc2313..e48068e8 100644
--- a/lib/VNWeb/User/Edit.pm
+++ b/lib/VNWeb/User/Edit.pm
@@ -32,7 +32,6 @@ my $FORM = {
# Settings that can only be read/modified by the user itself or a perm_usermod
prefs => { required => 0, type => 'hash', keys => {
email => { email => 1 },
- show_nsfw => { anybool => 1 },
max_sexual => { int => 1, range => [-1, 2 ] },
max_violence => { uint => 1, range => [ 0, 2 ] },
traits_sexual => { anybool => 1 },
@@ -81,7 +80,7 @@ TUWF::get qr{/$RE{uid}/edit}, sub {
$u->{prefs} = $u->{id} == auth->uid || auth->permUsermod ?
tuwf->dbRowi(
- 'SELECT show_nsfw, max_sexual, max_violence, traits_sexual, tags_all, tags_cont, tags_ero, tags_tech, spoilers, skin, customcss
+ 'SELECT max_sexual, max_violence, traits_sexual, tags_all, tags_cont, tags_ero, tags_tech, spoilers, skin, customcss
, nodistract_noads, nodistract_nofancy, support_enabled, uniname, pubskin_enabled
FROM users WHERE id =', \$u->{id}
) : undef;
@@ -118,7 +117,7 @@ elm_api UserEdit => $FORM_OUT, $FORM_IN, sub {
return elm_Taken if $p->{uniname} && tuwf->dbVali('SELECT 1 FROM users WHERE id <>', \$data->{id}, 'AND username =', \lc($p->{uniname}));
$set{$_} = $p->{$_} for qw/
- show_nsfw max_sexual max_violence traits_sexual tags_all tags_cont tags_ero tags_tech spoilers skin customcss
+ max_sexual max_violence traits_sexual tags_all tags_cont tags_ero tags_tech spoilers skin customcss
nodistract_noads nodistract_nofancy support_enabled uniname pubskin_enabled
/;
}
diff --git a/lib/VNWeb/Validation.pm b/lib/VNWeb/Validation.pm
index caf6491d..e122a8be 100644
--- a/lib/VNWeb/Validation.pm
+++ b/lib/VNWeb/Validation.pm
@@ -242,7 +242,7 @@ sub viewget {
{
spoilers => $sp // auth->pref('spoilers') || 0,
traits_sexual => !$ts ? auth->pref('traits_sexual') : $ts eq 's',
- show_nsfw => !$ns ? auth->pref('show_nsfw') : $ns eq 'n',
+ show_nsfw => !$ns ? (auth->pref('max_sexual')||0)==2 && (auth->pref('max_violence')||0)>0 : $ns eq 'n',
}
};
tuwf->req->{view}