Page: Add 'title' column, storing title of last revision

This commit is contained in:
2022-03-27 09:23:35 +02:00
bovenliggende ac793c6d39
commit f7cf06cdd5
5 gewijzigde bestanden met toevoegingen van 17 en 8 verwijderingen

Bestand weergeven

@ -66,6 +66,7 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
this->database->beginTransaction();
std::string visiblecmd = parser.extractCommand("visible", newContent);
std::string rename = parser.extractCommand("rename", newContent);
std::string customtitle = parser.extractCommand("pagetitle", newContent);
Page page;
std::optional<Page> currentPage = pageDao.find(pagename);
if(currentPage)
@ -83,6 +84,11 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
page.current_revision = current_revision;
page.listed = !(visiblecmd == "0");
page.name = pagename;
page.title = customtitle;
if(page.title.empty())
{
page.title = page.name;
}
pageDao.save(page);
Revision newRevision;