summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Releases
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-11-29 13:26:55 +0100
committerYorhel <git@yorhel.nl>2021-11-29 13:26:55 +0100
commitfa86ca885a5aa08543207ad8a64d42f05ab52caf (patch)
tree27415688dbf1bce388290fb55e3018ab16cfe981 /lib/VNWeb/Releases
parent29c0ce366ef7f089a72732cc7e9ae4f924ded7a3 (diff)
Releases: Allow "uncensored" flag to be unknown
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r--lib/VNWeb/Releases/Edit.pm20
-rw-r--r--lib/VNWeb/Releases/Page.pm4
2 files changed, 17 insertions, 7 deletions
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm
index fe69d1b6..65cff99e 100644
--- a/lib/VNWeb/Releases/Edit.pm
+++ b/lib/VNWeb/Releases/Edit.pm
@@ -24,7 +24,7 @@ my $FORM = {
catalog => { required => 0, default => '', maxlength => 50 },
released => { default => 99999999, min => 1, rdate => 1 },
minage => { required => 0, default => undef, int => 1, enum => \%AGE_RATING },
- uncensored => { anybool => 1 },
+ uncensored => { required => 0, jsonbool => 1 },
reso_x => { uint => 1, range => [0,32767] },
reso_y => { uint => 1, range => [0,32767] },
voiced => { uint => 1, enum => \%VOICED },
@@ -131,14 +131,24 @@ elm_api ReleaseEdit => $FORM_OUT, $FORM_IN, sub {
my $e = $new ? { id => 0 } : db_entry $data->{id} or return tuwf->resNotFound;
return elm_Unauth if !can_edit r => $e;
+ $data->{uncensored} = $data->{uncensored}?1:0 if defined $data->{uncensored};
+
if(!auth->permDbmod) {
$data->{hidden} = $e->{hidden}||0;
$data->{locked} = $e->{locked}||0;
}
- $data->{doujin} = $data->{voiced} = $data->{ani_story} = $data->{ani_ero} = 0 if $data->{patch};
- $data->{reso_x} = $data->{reso_y} = 0 if $data->{patch};
- $data->{engine} = '' if $data->{patch};
- $data->{uncensored} = $data->{ani_ero} = 0 if !defined $data->{minage} || $data->{minage} != 18;
+
+ if($data->{patch}) {
+ $data->{doujin} = $data->{voiced} = $data->{ani_story} = $data->{ani_ero} = 0;
+ $data->{reso_x} = $data->{reso_y} = 0;
+ $data->{engine} = '';
+ }
+
+ if(!defined $data->{minage} || $data->{minage} != 18) {
+ $data->{uncensored} = undef;
+ $data->{ani_ero} = 0;
+ }
+
$_->{qty} = $MEDIUM{$_->{medium}}{qty} ? $_->{qty}||1 : 0 for $data->{media}->@*;
$data->{notes} = bb_subst_links $data->{notes};
die "No VNs selected" if !$data->{vn}->@*;
diff --git a/lib/VNWeb/Releases/Page.pm b/lib/VNWeb/Releases/Page.pm
index dbc799f7..5078376a 100644
--- a/lib/VNWeb/Releases/Page.pm
+++ b/lib/VNWeb/Releases/Page.pm
@@ -164,8 +164,8 @@ sub _infotable_ {
tr_ sub {
td_ 'Censoring';
- td_ $r->{uncensored} ? 'No optical censoring (e.g. mosaics)' : 'May include optical censoring (e.g. mosaics)';
- } if $r->{minage} && $r->{minage} == 18;
+ td_ $r->{uncensored} ? 'No optical censoring (like mosaics)' : 'Includes optical censoring (e.g. mosaics)';
+ } if defined $r->{uncensored};
for my $t (qw|developer publisher|) {
my @prod = grep $_->{$t}, @{$r->{producers}};