diff options
author | Yorhel <git@yorhel.nl> | 2020-11-12 05:20:50 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-11-12 05:22:45 +0100 |
commit | 2d0dddc0b29e720e0b868e20141b90915fc37622 (patch) | |
tree | b5e42f38e3caa882efc3bb04e53dfcb3d207bbed | |
parent | dd4c7c7c21054ea48985510144c88a1fd823cdd8 (diff) |
Reviews: Display spoiler flag when spoilers are enabled in profile
Otherwise people who have enabled spoilers won't be able to see the
spoiler flag at all.
-rw-r--r-- | lib/VNWeb/Reviews/Page.pm | 6 | ||||
-rw-r--r-- | lib/VNWeb/Reviews/VNTab.pm | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm index 83f8dc21..e9337e2f 100644 --- a/lib/VNWeb/Reviews/Page.pm +++ b/lib/VNWeb/Reviews/Page.pm @@ -51,7 +51,7 @@ sub review_ { my($date, $lastmod) = map $_&&fmtdate($_,'compact'), $w->@{'date', 'lastmod'}; txt_ " on $date"; b_ class => 'grayedout', " last updated on $lastmod" if $lastmod && $date ne $lastmod; - br_ if $w->{c_flagged} || $w->{locked}; + br_ if $w->{c_flagged} || $w->{locked} || ($w->{spoiler} && (auth->pref('spoilers')||0) == 2); if($w->{c_flagged}) { br_; b_ class => 'grayedout', 'Flagged: this review is below the voting threshold and not visible on the VN page.'; @@ -60,6 +60,10 @@ sub review_ { br_; b_ class => 'grayedout', 'Locked: commenting on this review has been disabled.'; } + if($w->{spoiler} && (auth->pref('spoilers')||0) == 2) { + br_; + b_ 'This review contains spoilers.'; + } } }; tr_ class => 'reviewnotspoil', sub { diff --git a/lib/VNWeb/Reviews/VNTab.pm b/lib/VNWeb/Reviews/VNTab.pm index 2f11d439..b2120e18 100644 --- a/lib/VNWeb/Reviews/VNTab.pm +++ b/lib/VNWeb/Reviews/VNTab.pm @@ -28,7 +28,10 @@ sub reviews_ { article_ class => 'reviewbox', sub { my $r = $_; div_ sub { - span_ sub { txt_ 'By '; user_ $r; txt_ ' on '.fmtdate $r->{date}, 'compact' }; + span_ sub { + txt_ 'By '; user_ $r; txt_ ' on '.fmtdate $r->{date}, 'compact'; + b_ class => 'grayedout', ' contains spoilers' if $r->{spoiler} && (auth->pref('spoilers')||0) == 2; + }; a_ href => "/r$r->{rid}", "r$r->{rid}" if $r->{rid}; span_ "Vote: ".fmtvote($r->{vote}) if $r->{vote}; }; |