summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-06-15 20:25:20 +0200
committerYorhel <git@yorhel.nl>2009-06-15 20:25:50 +0200
commit9c917a5d7c1f55b44d6feba50e41639e798f7011 (patch)
tree0f0f20d1d7247aaa6cd76cb8e56cef72dd9a92c2
parent7db9c59dcad1cd8891f23cd7af0ead799513bfd4 (diff)
Don't show NSFW images on diff pages by default
-rw-r--r--ChangeLog3
-rw-r--r--lib/VNDB/Handler/VNPage.pm7
-rw-r--r--lib/VNDB/Util/CommonHTML.pm4
3 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 03e29094..a444720d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2.5 - ?
+ - Hide NSFW images in diff viewer (unless NSFW warnings are disabled)
+
2.4 - 2009-06-07
- Release search + browser + filters
- Javascript date input
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index fac6305b..21c0e13d 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -216,7 +216,12 @@ sub _revision {
return @r ? @r : ('[no screenshots]');
}],
[ image => 'Image', htmlize => sub {
- $_[0] > 0 ? sprintf '<img src="%s/cv/%02d/%d.jpg" />', $self->{url_static}, $_[0]%100, $_[0] : $_[0] < 0 ? '[processing]' : 'No image';
+ my $url = sprintf "%s/cv/%02d/%d.jpg", $self->{url_static}, $_[0]%100, $_[0];
+ if($_[0] > 0) {
+ return $_[1]->{img_nsfw} && !$self->authInfo->{show_nsfw} ? "<a href=\"$url\">(NSFW)</a>" : "<img src=\"$url\" />";
+ } else {
+ return $_[0] < 0 ? '[processing]' : 'No image';
+ }
}],
[ img_nsfw => 'Image NSFW', serialize => sub { $_[0] ? 'Not safe' : 'Safe' } ],
);
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 7421b1c0..8199cf20 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -317,8 +317,8 @@ sub revdiff {
$o{diff}++ if $o{split};
$o{join} ||= '';
- my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}) : $old->{$short};
- my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}) : $new->{$short};
+ my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}, $old) : $old->{$short};
+ my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}, $new) : $new->{$short};
return if $ser1 eq $ser2;
if($o{diff} && $ser1 && $ser2) {