Mercurial > hgrepos > hgweb.cgi > s4
changeset 247:d0984b8e9f4c
Use temp.view readableblogs instead of writing down where condition.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 16 Jul 2016 11:15:42 +0859 |
parents | de0a9f5cc1cf |
children | 99a350b3e283 |
files | s4-funcs.sh |
diffstat | 1 files changed, 3 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-funcs.sh Tue Jul 12 10:04:34 2016 +0859 +++ b/s4-funcs.sh Sat Jul 16 11:15:42 2016 +0859 @@ -1384,15 +1384,16 @@ } listnewblogsql() { # $1=user cat<<EOF +`sql4readableblogs` with article_ctime as ( select id,blogid,author,val ctime from article join article_s s using(id) where s.key='ctime' ), blog_title_owner as ( - select blog.rowid, id, + select blg.rowid, id, max(case key when 'title' then val end) title, max(case key when 'owner' then val end) owner - from blog, blog_s using(id) group by id + from readableblogs blg, blog_s using(id) group by id ), acclog_user as ( select * from acclog where user='$user' and tbl='blog' ), blogall as ( @@ -1411,16 +1412,6 @@ (select gecos from gecoses where name=bl.owner) gecos from blogall bl left join acclog_user l on bl.rowid=round(l.tblrowid) - where case when (select name from user where owner=name) is not null - then 1 /* user's diary is always readable */ - when (select val from grp_s - where gname=owner and key='regmode') = 'moderated' - and -- moderated group and nonmember can't read, not counting - (select user from grp_mem - where gname=owner and user='$user') is null - then 0 - else 1 - end group by bl.id having "新着" > 0 order by ctime desc, "新着" desc, bl.id limit 10;