Handlers: set page title

This commit is contained in:
2019-09-29 21:34:53 +02:00
parent ec10c764d5
commit d9de46354e
11 changed files with 20 additions and 1 deletions

View File

@@ -27,13 +27,14 @@ Response HandlerHistory::handleRequest(const Request &r)
{
QueryOption qo = queryOption(r);
std::string page = r.get("page");
std::string title;
if(page.empty())
{
if(!this->userSession->user.permissions.canSeeGlobalHistory())
{
return errorResponse("Permission denied", "You can't see the changes history on this wiki", 403);
}
title = "History";
}
else
{
@@ -42,6 +43,7 @@ Response HandlerHistory::handleRequest(const Request &r)
{
return errorResponse("Permission denied", "You cannot see the changes history of this page", 403);
}
title = "History: " + page;
}
unsigned int count = 0;
@@ -113,6 +115,7 @@ Response HandlerHistory::handleRequest(const Request &r)
unsigned int neworder = (qo.order == DESCENDING) ? ASCENDING : DESCENDING;
historyPage.setVar("linkrecentsort", makeSortedLink(qo.limit, qo.offset, neworder));
historyPage.setVar("revisionlist", this->templ->renderRevisionList(resultList, page.empty()));
historyPage.setVar("title", createPageTitle(title));
Response response;
response.setBody(historyPage.render());
response.setStatus(200);