From 9c917a5d7c1f55b44d6feba50e41639e798f7011 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 15 Jun 2009 20:25:20 +0200 Subject: Don't show NSFW images on diff pages by default --- ChangeLog | 3 +++ lib/VNDB/Handler/VNPage.pm | 7 ++++++- lib/VNDB/Util/CommonHTML.pm | 4 ++-- 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 '', $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} ? "(NSFW)" : ""; + } 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) { -- cgit v1.2.3