some workarounds in Thread plugin (don't show stale info in html forms)

This commit is contained in:
Tomasz Sowa 2021-05-27 10:29:26 +02:00
parent fb64f5e456
commit aa71abd725
4 changed files with 47 additions and 2 deletions

View File

@ -102,6 +102,13 @@ void CreateThread::MakePost()
cur->request->item.parent_id = cur->request->dir_tab.back()->id;
cur->request->item.item_content.privileges = system->NewFilePrivileges();
/*
* temporary
* html templates are using last_item, and if CheckAbuse() returned true
* then the form would be empty
*/
cur->request->last_item = &cur->request->item;
if( functions->CheckAbuse() )
return;
@ -134,6 +141,17 @@ void CreateThread::MakePost()
}
void CreateThread::MakeGet()
{
/*
* workaround:
* html form showed the title from the last directory
* this will be removed when new ezc object templates will be implemented
*/
empty_item.Clear();
cur->request->last_item = &empty_item;
}

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -54,6 +54,7 @@ public:
CreateThread();
bool HasAccess();
void MakePost();
void MakeGet();
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
@ -64,6 +65,7 @@ private:
ThreadInfo * thread_info;
Thread thread;
NotifyMsg notify_msg;
Item empty_item;
void SendNotify(const Item & item);
};

View File

@ -132,6 +132,17 @@ void Reply::MakePost()
answer.parent_id = files_dir->id;
answer.item_content.privileges = system->NewFilePrivileges();
/*
* temporary
* html templates are using last_item, and if CheckAbuse() returned true
* then the form would be empty
*
* here would be better to have something like last_item pointing to answer
* so when CheckAbuse() returned true thew we would show provieded values in the html form
*/
cur->request->last_item = &cur->request->item;
cur->request->item.item_content.guest_name.clear();
if( functions->CheckAbuse() )
return;
@ -157,6 +168,18 @@ void Reply::MakePost()
}
void Reply::MakeGet()
{
/*
* workaround:
* html form showed the nick name from item
* 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();
}
} // namespace

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -55,6 +55,7 @@ public:
Reply();
bool HasAccess();
void MakePost();
void MakeGet();
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
@ -68,6 +69,7 @@ private:
Thread thread;
Item * files_dir;
NotifyMsg notify_msg;
Item empty_item;
void SendNotify(const Item & item);
};