- added to Request: is_htmx_request (bool) - true if the request is made by htmx library (ajax)

- commented out using mount_page_arg_is "subject" and "info" from fun_cat.html and fun_run.html - they will be removed soon
- some improvements in fun_reply.html, fun_showthreads.html and fun_thread.html (scrolling)
This commit is contained in:
2021-05-31 10:58:34 +02:00
parent e6fae4598c
commit 22de3322ae
18 changed files with 112 additions and 34 deletions

View File

@@ -95,6 +95,10 @@ void CreateThread::SendNotify(const Item & item)
void CreateThread::MakePost()
{
// is it a correct bahavior to set spam_score in session?
// after the first mistake the person will not be allowed to post anything
cur->session->spam_score = 0;
cur->request->item.Clear();
functions->ReadItem(cur->request->item, Item::file);
functions->SetUser(cur->request->item);

View File

@@ -112,6 +112,10 @@ void Reply::MakePost()
// !! jak bedzie dostepne assert
// ASSERT(files_dir)
// is it a correct bahavior to set spam_score in session?
// after the first mistake the person will not be allowed to post anything
cur->session->spam_score = 0;
thread = Thread::get_thread(model_connector, cur->request->item.id);
if( !thread.found() )
@@ -143,8 +147,18 @@ void Reply::MakePost()
cur->request->last_item = &cur->request->item;
cur->request->item.item_content.guest_name.clear();
if( functions->CheckAbuse() )
if( functions->CheckAbuse(&slog) )
{
// temporary: to show values in the html form
// this will be changed when a new ezc objects will be implemented
// there'll be two objects: one registered as [item..] and the other registered as [answer..]
// (one for url and the other for content)
cur->request->item.item_content.content_raw = answer.item_content.content_raw;
cur->request->item.item_content.content_raw_type = answer.item_content.content_raw_type;
cur->request->item.item_content.guest_name = answer.item_content.guest_name;
return;
}
plugin->Call(WINIX_PL_THREAD_PREPARE_TO_REPLY_IN_THREAD, &answer);
@@ -157,7 +171,17 @@ void Reply::MakePost()
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "Reply: added an answer in a thread" << logend;
thread_info->MakeRedirectIfPossible(cur->request->item);
const wchar_t * postfix = nullptr;
if( cur->request->IsParam(L"scrollup") )
postfix = L"/-/scrollup";
if( cur->request->IsParam(L"scrolldown") )
postfix = L"/-/scrolldown";
thread_info->MakeRedirectIfPossible(cur->request->item, postfix);
SendNotify(cur->request->item);
}
else
@@ -172,12 +196,14 @@ void Reply::MakeGet()
{
/*
* workaround:
* html form showed the nick name from item
* html form showed the nick name from item (and content)
* this will be removed when new ezc object templates will be implemented
* we can provide two item templates: one for [item_url] and the rest for the html form
* [item_url] is used in <form...>
*/
cur->request->item.item_content.guest_name.clear();
cur->request->item.item_content.content_raw.clear();
}

View File

@@ -194,7 +194,7 @@ void ThreadInfo::Repair()
void ThreadInfo::MakeRedirectIfPossible(const Item & item)
void ThreadInfo::MakeRedirectIfPossible(const Item & item, const wchar_t * postfix)
{
PluginRes res = plugin->Call(WINIX_PL_THREAD_CAN_MAKE_REDIRECT);
@@ -204,7 +204,7 @@ void ThreadInfo::MakeRedirectIfPossible(const Item & item)
return;
}
system->RedirectTo(item);
system->RedirectTo(item, postfix);
}

View File

@@ -99,7 +99,7 @@ public:
// repairing the database
void Repair();
void MakeRedirectIfPossible(const Item & item);
void MakeRedirectIfPossible(const Item & item, const wchar_t * postfix = nullptr);
private: