Add option to limit the maximum thread depth of comments

This commit is contained in:
Kijin Sung 2024-10-09 16:45:36 +09:00
parent 81d9f46098
commit a4e9eb4a00
8 changed files with 60 additions and 0 deletions

View file

@ -1149,6 +1149,17 @@ class BoardView extends Board
return $this->dispBoardMessage('msg_not_founded', 404);
}
// Check thread depth
$comment_config = ModuleModel::getModulePartConfig('comment', $this->module_srl);
if (isset($comment_config->max_thread_depth) && $comment_config->max_thread_depth > 0)
{
$parent_depth = CommentModel::getCommentDepth($parent_srl);
if ($parent_depth + 2 > $comment_config->max_thread_depth)
{
return $this->dispBoardMessage('msg_exceeds_max_thread_depth');
}
}
// Check allow comment
$oDocument = DocumentModel::getDocument($oSourceComment->get('document_srl'));
if(!$oDocument->allowComment())