HandlerPageView: Set 'createdon' dynamic variable
Αυτή η υποβολή περιλαμβάνεται σε:
γονέας
0325cdf936
υποβολή
86890660f4
@ -90,19 +90,20 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
|
||||
std::optional<Revision> revision;
|
||||
std::string templatepartname;
|
||||
auto revisionDao = this->database->createRevisionDao();
|
||||
try
|
||||
{
|
||||
if(revisionid > 0)
|
||||
{
|
||||
if(!effectivePermissions(pagename).canSeePageHistory())
|
||||
{
|
||||
auto current = this->database->createRevisionDao()->getCurrentForPage(pagename);
|
||||
auto current = revisionDao->getCurrentForPage(pagename);
|
||||
if(current && current->revision > revisionid)
|
||||
{
|
||||
return errorResponse("Error", "You are not allowed to view older revisions of this page");
|
||||
}
|
||||
}
|
||||
revision = this->database->createRevisionDao()->getRevisionForPage(pagename, revisionid);
|
||||
revision = revisionDao->getRevisionForPage(pagename, revisionid);
|
||||
if(!revision)
|
||||
{
|
||||
return errorResponse("Revision not found", "No such revision found");
|
||||
@ -122,7 +123,7 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
return r;
|
||||
}
|
||||
}
|
||||
revision = this->database->createRevisionDao()->getCurrentForPage(pagename);
|
||||
revision = revisionDao->getCurrentForPage(pagename);
|
||||
templatepartname = "page_view";
|
||||
}
|
||||
}
|
||||
@ -175,6 +176,15 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
}
|
||||
return std::string{};
|
||||
};
|
||||
|
||||
auto firstRevision = revisionDao->getRevisionForPage(pagename, 1);
|
||||
if(!firstRevision)
|
||||
{
|
||||
return errorResponse("Error", "Could not get first revision for page, which is odd. Solar flares?");
|
||||
}
|
||||
|
||||
dynamicVarsMap["createdon"] = utils::toISODate(firstRevision.value().timestamp);
|
||||
|
||||
std::string resolvedContent = parser.parseDynamics(revision->content, dynamicParseCallback);
|
||||
if(revisionid > 0)
|
||||
{
|
||||
|
Φόρτωση…
Αναφορά σε νέο ζήτημα
Block a user