mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 21:12:15 +09:00
Clean up vote cancel functions and ensure consistency between document and comment modules #1367
This commit is contained in:
parent
b97ca16b6c
commit
3f620481cf
2 changed files with 9 additions and 6 deletions
|
|
@ -162,15 +162,18 @@ class commentController extends comment
|
||||||
|
|
||||||
function updateVotedCountCancel($comment_srl, $oComment, $point)
|
function updateVotedCountCancel($comment_srl, $oComment, $point)
|
||||||
{
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
if(!$_SESSION['voted_comment'][$comment_srl] && !$this->user->member_srl)
|
||||||
|
{
|
||||||
|
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the current user has voted previously.
|
// Check if the current user has voted previously.
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
$args->point = $point;
|
$args->point = $point;
|
||||||
if($logged_info->member_srl)
|
if($this->user->member_srl)
|
||||||
{
|
{
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $this->user->member_srl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -206,7 +209,7 @@ class commentController extends comment
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$d_args = new stdClass();
|
$d_args = new stdClass();
|
||||||
$args->comment_srl = $d_args->comment_srl = $comment_srl;
|
$args->comment_srl = $d_args->comment_srl = $comment_srl;
|
||||||
$d_args->member_srl = $logged_info->member_srl;
|
$d_args->member_srl = $this->user->member_srl;
|
||||||
if ($trigger_obj->update_target === 'voted_count')
|
if ($trigger_obj->update_target === 'voted_count')
|
||||||
{
|
{
|
||||||
$args->voted_count = $trigger_obj->after_point;
|
$args->voted_count = $trigger_obj->after_point;
|
||||||
|
|
@ -221,7 +224,7 @@ class commentController extends comment
|
||||||
if(!$d_output->toBool()) return $d_output;
|
if(!$d_output->toBool()) return $d_output;
|
||||||
|
|
||||||
//session reset
|
//session reset
|
||||||
$_SESSION['voted_comment'][$comment_srl] = false;
|
unset($_SESSION['voted_comment'][$comment_srl]);
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('comment.updateVotedCountCancel', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('comment.updateVotedCountCancel', 'after', $trigger_obj);
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ class documentController extends document
|
||||||
if(!$d_output->toBool()) return $d_output;
|
if(!$d_output->toBool()) return $d_output;
|
||||||
}
|
}
|
||||||
// session reset
|
// session reset
|
||||||
$_SESSION['voted_document'][$document_srl] = false;
|
unset($_SESSION['voted_document'][$document_srl]);
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.updateVotedCountCancel', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('document.updateVotedCountCancel', 'after', $trigger_obj);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue