Clean up comment deletion routine

This commit is contained in:
Kijin Sung 2016-12-20 14:37:49 +09:00
parent 92b73a1149
commit d31536159f
3 changed files with 9 additions and 18 deletions

View file

@ -521,8 +521,6 @@ class boardController extends board
if($this->module_info->comment_delete_message === 'yes' && $instant_delete != 'Y')
{
$comment->content = '';
$comment->status = 7;
$output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager);
}
elseif(starts_with('only_comm', $this->module_info->comment_delete_message) && $instant_delete != 'Y')
@ -530,8 +528,6 @@ class boardController extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
$comment->content = '';
$comment->status = 7;
$output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager);
}
else

View file

@ -912,23 +912,29 @@ class commentController extends comment
*/
function updateCommentByDelete($obj, $is_admin = FALSE)
{
$logged_info = Context::get('logged_info');
if (!$obj->comment_srl)
{
return new Object(-1, 'msg_invalid_request');
}
// begin transaction
$oDB = DB::getInstance();
$oDB->begin();
// If the case manager to delete comments, it indicated that the administrator deleted.
$logged_info = Context::get('logged_info');
if($is_admin === true && $obj->member_srl !== $logged_info->member_srl)
{
$obj->content = lang('msg_admin_deleted_comment');
$obj->status = 8;
$obj->status = RX_STATUS_DELETED_BY_ADMIN;
}
else
{
$obj->content = lang('msg_deleted_comment');
$obj->status = RX_STATUS_DELETED;
}
$obj->member_srl = 0;
unset($obj->last_update);
$output = executeQuery('comment.updateCommentByDelete', $obj);
if(!$output->toBool())
{

View file

@ -3,19 +3,8 @@
<table name="comments" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="member_srl" var="member_srl" />
<column name="parent_srl" var="parent_srl" filter="number" />
<column name="is_secret" var="is_secret" default="N" />
<column name="notify_message" var="notify_message" default="N" />
<column name="content" var="content" notnull="notnull" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="user_id" var="user_id" />
<column name="user_name" var="user_name" default="" />
<column name="nick_name" var="nick_name" notnull="notnull" minlength="1" maxlength="40" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="uploaded_count" var="uploaded_count" default="0" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="status" var="status" default="1" />
</columns>