mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix #1119 inconsistent point handling when moving comments in and out of Trash
This commit is contained in:
parent
93284d0787
commit
4158d94606
5 changed files with 56 additions and 6 deletions
|
|
@ -220,7 +220,7 @@ class commentAdminController extends comment
|
|||
continue;
|
||||
}
|
||||
|
||||
$output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash);
|
||||
$output = $oCommentController->deleteComment($comment_srl, TRUE, toBool($isTrash));
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
|
|
@ -310,6 +310,16 @@ class commentAdminController extends comment
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->comment_srl = $oComment->get('comment_srl');
|
||||
$obj->module_srl = $oComment->get('module_srl');
|
||||
$obj->document_srl = $oComment->get('document_srl');
|
||||
$obj->parent_srl = $oComment->get('parent_srl');
|
||||
$obj->member_srl = $oComment->get('member_srl');
|
||||
$obj->regdate = $oComment->get('regdate');
|
||||
$obj->last_update = $oComment->get('last_update');
|
||||
ModuleHandler::triggerCall('comment.moveCommentToTrash', 'after', $obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1016,6 +1016,7 @@ class commentController extends comment
|
|||
$document_srl = $comment->document_srl;
|
||||
|
||||
// call a trigger (before)
|
||||
$comment->isMoveToTrash = $isMoveToTrash ? true : false;
|
||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
|
|
@ -1123,7 +1124,6 @@ class commentController extends comment
|
|||
}
|
||||
|
||||
// call a trigger (after)
|
||||
$comment->isMoveToTrash = $isMoveToTrash;
|
||||
ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
||||
unset($comment->isMoveToTrash);
|
||||
|
||||
|
|
@ -1179,9 +1179,8 @@ class commentController extends comment
|
|||
return new BaseObject(-1, 'msg_admin_comment_no_move_to_trash');
|
||||
}
|
||||
|
||||
$trash_args->module_srl = $oComment->variables['module_srl'];
|
||||
$obj->module_srl = $oComment->variables['module_srl'];
|
||||
|
||||
$obj->module_srl = $oComment->get('module_srl');
|
||||
$trash_args->module_srl = $obj->module_srl;
|
||||
if($trash_args->module_srl === 0)
|
||||
{
|
||||
return new BaseObject(-1, 'msg_module_srl_not_exists');
|
||||
|
|
@ -1257,6 +1256,11 @@ class commentController extends comment
|
|||
executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
$obj->document_srl = $oComment->get('document_srl');
|
||||
$obj->parent_srl = $oComment->get('parent_srl');
|
||||
$obj->member_srl = $oComment->get('member_srl');
|
||||
$obj->regdate = $oComment->get('regdate');
|
||||
$obj->last_update = $oComment->get('last_update');
|
||||
ModuleHandler::triggerCall('comment.moveCommentToTrash', 'after', $obj);
|
||||
|
||||
$oDB->commit();
|
||||
|
|
|
|||
|
|
@ -397,6 +397,7 @@ class documentController extends document
|
|||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
if(!$obj->email_address) $obj->email_address = '';
|
||||
if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$obj->isRestore = $isRestore ? true : false;
|
||||
|
||||
// Default Status
|
||||
if($obj->status)
|
||||
|
|
@ -936,6 +937,7 @@ class documentController extends document
|
|||
// Call a trigger (before)
|
||||
$trigger_obj = new stdClass();
|
||||
$trigger_obj->document_srl = $document_srl;
|
||||
$trigger_obj->isEmptyTrash = $isEmptyTrash ? true : false;
|
||||
$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
|
|
@ -992,6 +994,7 @@ class documentController extends document
|
|||
|
||||
// Call a trigger (after)
|
||||
$trigger_obj = $oDocument->getObjectVars();
|
||||
$trigger_obj->isEmptyTrash = $isEmptyTrash ? true : false;
|
||||
ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
|
||||
|
||||
// declared document, log delete
|
||||
|
|
@ -1153,6 +1156,10 @@ class documentController extends document
|
|||
}
|
||||
|
||||
// Call a trigger (after)
|
||||
$obj->module_srl = $oDocument->get('module_srl');
|
||||
$obj->member_srl = $oDocument->get('member_srl');
|
||||
$obj->regdate = $oDocument->get('regdate');
|
||||
$obj->last_update = $oDocument->get('last_update');
|
||||
ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj);
|
||||
|
||||
// commit
|
||||
|
|
|
|||
|
|
@ -32,9 +32,11 @@ class point extends ModuleObject
|
|||
array('document.insertDocument', 'after', 'controller', 'triggerInsertDocument'),
|
||||
array('document.updateDocument', 'before', 'controller', 'triggerUpdateDocument'),
|
||||
array('document.deleteDocument', 'after', 'controller', 'triggerDeleteDocument'),
|
||||
array('document.moveDocumentToTrash', 'after', 'controller', 'triggerTrashDocument'),
|
||||
array('comment.insertComment', 'after', 'controller', 'triggerInsertComment'),
|
||||
array('comment.updateComment', 'after', 'controller', 'triggerUpdateComment'),
|
||||
array('comment.deleteComment', 'after', 'controller', 'triggerDeleteComment'),
|
||||
array('comment.moveCommentToTrash', 'after', 'controller', 'triggerTrashComment'),
|
||||
array('file.deleteFile', 'after', 'controller', 'triggerDeleteFile'),
|
||||
array('file.downloadFile', 'before', 'controller', 'triggerBeforeDownloadFile'),
|
||||
array('file.downloadFile', 'after', 'controller', 'triggerDownloadFile'),
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class pointController extends point
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief A trigger to give points for deleting the post
|
||||
* @brief A trigger to deduct points for deleting the post
|
||||
*/
|
||||
public function triggerDeleteDocument($obj)
|
||||
{
|
||||
|
|
@ -186,6 +186,10 @@ class pointController extends point
|
|||
{
|
||||
return;
|
||||
}
|
||||
if ($obj->isEmptyTrash)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// The fix to disable giving points for saving the document temporarily
|
||||
if ($module_srl == $member_srl)
|
||||
|
|
@ -211,6 +215,14 @@ class pointController extends point
|
|||
$this->setPoint($member_srl, $cur_point);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A trigger to deduct points when a document is moved to Trash
|
||||
*/
|
||||
public function triggerTrashDocument($obj)
|
||||
{
|
||||
return $this->triggerDeleteDocument($obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A trigger which gives points for entering a comment
|
||||
*/
|
||||
|
|
@ -275,6 +287,10 @@ class pointController extends point
|
|||
{
|
||||
return;
|
||||
}
|
||||
if ($obj->isMoveToTrash)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if the comment and the document have the same author.
|
||||
$oDocument = getModel('document')->getDocument($obj->document_srl);
|
||||
|
|
@ -291,6 +307,9 @@ class pointController extends point
|
|||
return;
|
||||
}
|
||||
|
||||
// Get the module_srl of the document to which this comment belongs
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
|
||||
// Get the points of the member
|
||||
$cur_point = getModel('point')->getPoint($member_srl);
|
||||
|
||||
|
|
@ -302,6 +321,14 @@ class pointController extends point
|
|||
$this->setPoint($member_srl, $cur_point);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A trigger to deduct points when a comment is moved to Trash
|
||||
*/
|
||||
public function triggerTrashComment($obj)
|
||||
{
|
||||
return $this->triggerDeleteComment($obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add the file registration trigger
|
||||
* To prevent taking points for invalid file registration this method wlil return a null object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue