diff options
author | Yorhel <git@yorhel.nl> | 2019-11-19 11:45:28 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-11-19 11:45:30 +0100 |
commit | 559d6a191053a26b089c2f24946b58838f9b2cc9 (patch) | |
tree | 5d01767b6a6257e720bbcb56f8d4eecea8016c60 /lib/VNWeb | |
parent | caca1389c6dcbf895df8e3cfae55db7dadc2d276 (diff) |
Minor refactor: Use dbPage() in scalar context where applicable
Requires the latest git version of TUWF.
Diffstat (limited to 'lib/VNWeb')
-rw-r--r-- | lib/VNWeb/Discussions/UPosts.pm | 4 | ||||
-rw-r--r-- | lib/VNWeb/User/List.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/User/Lists.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/User/Notifications.pm | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/VNWeb/Discussions/UPosts.pm b/lib/VNWeb/Discussions/UPosts.pm index 733346ce..ead0ac7f 100644 --- a/lib/VNWeb/Discussions/UPosts.pm +++ b/lib/VNWeb/Discussions/UPosts.pm @@ -46,12 +46,12 @@ TUWF::get qr{/$RE{uid}/posts}, sub { WHERE NOT t.private AND NOT t.hidden AND NOT tp.hidden AND tp.uid =', \$u->{id}; my $count = tuwf->dbVali('SELECT count(*)', $from_and_where); - my($list) = $count ? tuwf->dbPagei( + my $list = $count && tuwf->dbPagei( { results => 50, page => $page }, 'SELECT tp.tid, tp.num, substring(tp.msg from 1 for 1000) as msg, t.title , ', sql_totime('tp.date'), 'as date', $from_and_where, 'ORDER BY tp.date DESC' - ) : (); + ); my $own = auth && $u->{id} == auth->uid; my $title = $own ? 'My posts' : 'Posts by '.user_displayname $u; diff --git a/lib/VNWeb/User/List.pm b/lib/VNWeb/User/List.pm index cb106a7c..c3694ddc 100644 --- a/lib/VNWeb/User/List.pm +++ b/lib/VNWeb/User/List.pm @@ -64,7 +64,7 @@ TUWF::get qr{/u/(?<char>[0a-z]|all)}, sub { ) : () ); - my($list) = tuwf->dbPagei({ results => 50, page => $opt->{p} }, + my $list = tuwf->dbPagei({ results => 50, page => $opt->{p} }, 'SELECT', sql_user(), ',', sql_totime('registered'), 'as registered, c_votes, c_changes, c_tags, hide_list FROM users u WHERE', sql_and('id > 0', @where), diff --git a/lib/VNWeb/User/Lists.pm b/lib/VNWeb/User/Lists.pm index d753d9f7..c7adf0ec 100644 --- a/lib/VNWeb/User/Lists.pm +++ b/lib/VNWeb/User/Lists.pm @@ -376,7 +376,7 @@ sub listing_ { my $count = tuwf->dbVali('SELECT count(*) FROM ulist_vns ul WHERE', $where); - my($lst) = tuwf->dbPagei({ page => $opt->{p}, results => 50 }, + my $lst = tuwf->dbPagei({ page => $opt->{p}, results => 50 }, 'SELECT v.id, v.title, v.original, ul.vote, ul.notes, ul.started, ul.finished ,', sql_totime('ul.added'), ' as added ,', sql_totime('ul.lastmod'), ' as lastmod diff --git a/lib/VNWeb/User/Notifications.pm b/lib/VNWeb/User/Notifications.pm index b9327c93..4f45e0b3 100644 --- a/lib/VNWeb/User/Notifications.pm +++ b/lib/VNWeb/User/Notifications.pm @@ -100,7 +100,7 @@ TUWF::get qr{/$RE{uid}/notifies}, sub { $opt->{r} ? () : 'read IS NULL' ); my $count = tuwf->dbVali('SELECT count(*) FROM notifications WHERE', $where); - my($list) = tuwf->dbPagei({ results => 25, page => $opt->{p} }, + my $list = tuwf->dbPagei({ results => 25, page => $opt->{p} }, 'SELECT n.id, n.ntype, n.ltype, n.iid, n.subid, n.c_title , ', sql_totime('n.date'), ' as date , ', sql_totime('n.read'), ' as read |