Fix #1119 inconsistent point handling when moving comments in and out of Trash

This commit is contained in:
Kijin Sung 2018-12-13 11:27:05 +09:00
parent 93284d0787
commit 4158d94606
5 changed files with 56 additions and 6 deletions

View file

@ -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