revisiondaosqlite: Don't ignore page visibility setting

This commit is contained in:
Albert S. 2018-11-04 20:08:39 +01:00
父節點 791de88324
當前提交 e863b5261b

查看文件

@ -51,10 +51,14 @@ std::vector<Revision> RevisionDaoSqlite::getAllRevisions(QueryOption &options)
try try
{ {
SqliteQueryOption queryOption{options}; SqliteQueryOption queryOption{options};
std::string queryOptionSql = queryOption.setPrependWhere(true).setOrderByColumn("id").build(); std::string queryOptionSql = queryOption.setPrependWhere(true)
.setVisibleColumnName("page.visible")
auto query = *db << "SELECT author, comment, content, strftime('%s',creationtime), (SELECT name FROM page " .setOrderByColumn("revisionid")
"WHERE page.id = page ), revisionid FROM revision " + .build();
auto query =
*db
<< "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), "
"page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id " +
queryOptionSql; queryOptionSql;
query >> [&](std::string author, std::string comment, std::string content, time_t creationtime, query >> [&](std::string author, std::string comment, std::string content, time_t creationtime,
std::string page, unsigned int revisionid) { std::string page, unsigned int revisionid) {
@ -86,11 +90,13 @@ std::vector<Revision> RevisionDaoSqlite::getAllRevisionsForPage(std::string page
try try
{ {
SqliteQueryOption queryOption{option}; SqliteQueryOption queryOption{option};
std::string queryOptionSql = queryOption.setPrependWhere(false).setOrderByColumn("id").build(); std::string queryOptionSql = queryOption.setPrependWhere(false)
.setVisibleColumnName("page.visible")
.setOrderByColumn("revisionid")
.build();
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, " auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, "
"strftime('%s',creationtime), (SELECT name FROM page WHERE page.id = page ), revisionid " "strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON "
"FROM revision WHERE page = (SELECT id FROM page WHERE name = ?) " + "revision.page = page.id WHERE page.name = ? AND " +
queryOptionSql queryOptionSql
<< pagename; << pagename;