summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-06-27 10:37:47 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-06-27 10:37:47 +0000
commitc88e5454cf32e4e3af51e64313aa3e82fdb65030 (patch)
treee21c2cd1d4caf8c814afd4f32c98dbe1fd404c10
parent14c629650a83878d49f9b902227dbd7cc7e0845e (diff)
Bugfix: votes and vnlist items shouldnt be visible when user has set this in the preferences
git-svn-id: svn://vndb.org/vndb@38 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
-rw-r--r--lib/ChangeLog3
-rw-r--r--lib/VNDB/HomePages.pm2
-rw-r--r--lib/VNDB/Util/DB.pm6
-rw-r--r--lib/VNDB/VN.pm4
4 files changed, 9 insertions, 6 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 74c142b6..f725ee25 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -5,10 +5,11 @@ TODO:
+ Remove all references to an item when it's hidden
(preferably with the option to re-add them when unhiding)
+ Add a link for the hidden 'h' option at /hist
- + The delete option should be removed
1.18 - ?
- Releases, producers and visual novel items can't be fully deleted anymore
+ - Hidden vote and vnlist items from the 'recent' lists on VN stat pages for
+ users who don't want that to be seen
1.17 - 2008-06-21 (r33)
- Added PS3 and Xbox 360 to platforms
diff --git a/lib/VNDB/HomePages.pm b/lib/VNDB/HomePages.pm
index 7ce07983..5c1ef3ef 100644
--- a/lib/VNDB/HomePages.pm
+++ b/lib/VNDB/HomePages.pm
@@ -25,7 +25,7 @@ sub HomePage {
recentvns => scalar $self->DBGetHist( results => 10, what => 'iid ititle', edits => 0, type => 'v'),
recentps => scalar $self->DBGetHist( results => 10, what => 'iid ititle', edits => 0, type => 'p'),
randomvns => scalar $self->DBGetVN( results => 10, order => 'RANDOM()'),
- recentvotes => scalar $self->DBGetVotes(results => 10),
+ recentvotes => scalar $self->DBGetVotes(results => 10, hide => 1),
popular => scalar $self->DBGetVN( results => 10, order => 'v.c_votes DESC'),
});
}
diff --git a/lib/VNDB/Util/DB.pm b/lib/VNDB/Util/DB.pm
index 822be2f1..7329b3f7 100644
--- a/lib/VNDB/Util/DB.pm
+++ b/lib/VNDB/Util/DB.pm
@@ -368,7 +368,7 @@ sub DBUpdateUser { # uid, %options->{ columns in users table }
#-----------------------------------------------------------------------------#
-sub DBGetVotes { # %options->{ uid vid order results page }
+sub DBGetVotes { # %options->{ uid vid hide order results page }
my($s, %o) = @_;
$o{order} ||= 'n.date DESC';
$o{results} ||= 50;
@@ -377,6 +377,7 @@ sub DBGetVotes { # %options->{ uid vid order results page }
my %where = (
$o{uid} ? ( 'n.uid = %d' => $o{uid} ) : (),
$o{vid} ? ( 'n.vid = %d' => $o{vid} ) : (),
+ $o{hide} ? ( 'u.flags & %d = %1$d' => $VNDB::UFLAGS->{votes} ) : (),
);
my $where = scalar keys %where ? 'WHERE !W' : '';
@@ -450,7 +451,7 @@ sub DBDelVote { # uid, vid # uid = 0 to delete all
#-----------------------------------------------------------------------------#
-sub DBGetVNList { # %options->{ uid vid order results page status }
+sub DBGetVNList { # %options->{ uid vid hide order results page status }
my($s, %o) = @_;
$o{results} ||= 10;
$o{page} ||= 1;
@@ -463,6 +464,7 @@ sub DBGetVNList { # %options->{ uid vid order results page status }
'l.vid = %d' => $o{vid} ) : (),
defined $o{status} ? (
'l.status = %d' => $o{status} ) : (),
+ $o{hide} ? ( 'u.flags & %d = %1$d' => $VNDB::UFLAGS->{list} ) : (),
);
return wantarray ? ([], 0) : [] if !keys %where;
diff --git a/lib/VNDB/VN.pm b/lib/VNDB/VN.pm
index 1a2a2ea7..52f67f4c 100644
--- a/lib/VNDB/VN.pm
+++ b/lib/VNDB/VN.pm
@@ -49,11 +49,11 @@ sub VNPage {
change => $r->{diff}||$r->{rev},
$page eq 'stats' ? (
lists => {
- latest => scalar $self->DBGetVNList(vid => $id, results => 7),
+ latest => scalar $self->DBGetVNList(vid => $id, results => 7, hide => 1),
graph => $self->DBVNListStats(vid => $id),
},
votes => {
- latest => scalar $self->DBGetVotes(vid => $id, results => 10),
+ latest => scalar $self->DBGetVotes(vid => $id, results => 10, hide => 1),
graph => $self->DBVoteStats(vid => $id),
},
) : (),