diff options
author | Yorhel <git@yorhel.nl> | 2020-01-28 09:23:45 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-01-28 16:42:44 +0100 |
commit | 915ea70075d6ffced641ac52cf567acc747aa7eb (patch) | |
tree | 1f0955db45b2f6048b35165eddf7a1e3e3f1e781 /lib/VNDB/DB/Tags.pm | |
parent | 495e03c42b378bfd5ee9bb0c431bac45c5e2b330 (diff) |
v2rw: Convert the VN tagmod interface
This also changes the voting interface a little bit:
- Spoiler options are a bit more concise
- Mouse-over a button indicates what it does
- The -1 and -2 options are not available anymore
- Downvoted tags are hidden by default
- Moderators can now vote-and-overrule in a single go
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r-- | lib/VNDB/DB/Tags.pm | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm index 875ff6e9..ed3ea9fe 100644 --- a/lib/VNDB/DB/Tags.pm +++ b/lib/VNDB/DB/Tags.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw|dbTagGet dbTTTree dbTagEdit dbTagAdd dbTagMerge dbTagLinks dbTagLinkEdit dbTagStats dbTagWipeVotes|; +our @EXPORT = qw|dbTagGet dbTTTree dbTagEdit dbTagAdd dbTagMerge dbTagLinks dbTagStats dbTagWipeVotes|; # %options->{ id noid name search state searchable applicable page results what sort reverse } @@ -211,38 +211,6 @@ sub dbTagLinks { } -# Change a user's tags for a VN entry -sub dbTagLinkEdit { - my($self, $uid, $vid, $insert, $update, $delete, $overrule) = @_; - - # overrule - # 1. set ignore flag for everyone except $uid - $self->dbExec('UPDATE tags_vn SET ignore = ? WHERE tag = ? AND vid = ? AND uid <> ?', - $overrule->{$_}?1:0, $_, $vid, $uid) for(keys %$overrule); - # 2. make sure $uid isn't ignored when others are set to ignore - # (this happens when a mod takes over an other mods' overrule) - $self->dbExec('UPDATE tags_vn SET ignore = false WHERE tag = ? AND vid = ? AND uid = ?', - $_, $vid, $uid) for(grep $overrule->{$_}, keys %$overrule); - - # delete - $self->dbExec('DELETE FROM tags_vn WHERE vid = ? AND uid = ? AND tag IN(!l)', - $vid, $uid, [ keys %$delete ]) if keys %$delete; - - # insert - my $val = join ',', map '(?,?,?,?,?,?)', keys %$insert; - $self->dbExec("INSERT INTO tags_vn (tag, vid, uid, vote, spoiler, ignore) VALUES $val", map - +($_, $vid, $uid, $insert->{$_}[0], $insert->{$_}[1]<0?undef:$insert->{$_}[1], $insert->{$_}[2]?1:0), - keys %$insert) if keys %$insert; - - # update - $self->dbExec('UPDATE tags_vn SET vote = ?, spoiler = ?, date = NOW() WHERE tag = ? AND vid = ? AND uid = ?', - $update->{$_}[0], $update->{$_}[1]<0?undef:$update->{$_}[1], $_, $vid, $uid) for (keys %$update); - - # Update cache - $self->dbExec('SELECT tag_vn_calc(?)', $vid); -} - - # Fetch all tags related to a VN # Argument: %options->{ vid minrating state results what page sort reverse } # sort: name, rating |