mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 16:52:16 +09:00
Check vote log before allowing cancellation
This commit is contained in:
parent
e7b272f7af
commit
75a468552d
9 changed files with 46 additions and 8 deletions
|
|
@ -79,7 +79,7 @@ class commentController extends comment
|
|||
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
|
||||
if($oComment->get('voted_count') <= 0)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_comment_voted_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
||||
}
|
||||
$point = 1;
|
||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||
|
|
@ -149,7 +149,7 @@ class commentController extends comment
|
|||
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
|
||||
if($oComment->get('blamed_count') >= 0)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_comment_blamed_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
||||
}
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||
|
|
@ -163,6 +163,24 @@ class commentController extends comment
|
|||
function updateVotedCountCancel($comment_srl, $oComment, $point)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Check if the current user has voted previously.
|
||||
$args = new stdClass;
|
||||
$args->comment_srl = $comment_srl;
|
||||
$args->point = $point;
|
||||
if($logged_info->member_srl)
|
||||
{
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$output = executeQuery('comment.getCommentVotedLogInfo', $args);
|
||||
if(!$output->data->count)
|
||||
{
|
||||
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
||||
}
|
||||
|
||||
// Call a trigger (before)
|
||||
$trigger_obj = new stdClass;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ $lang->trash = '휴지통';
|
|||
$lang->cmd_trash = '휴지통으로 이동';
|
||||
$lang->comment_count = '댓글 수';
|
||||
$lang->about_comment_count = '댓글을 정해진 수 만큼만 표시하고, 그 이상일 경우 페이지 번호를 표시해서 이동할 수 있게 합니다.';
|
||||
$lang->msg_comment_voted_cancel_not = '추천수가 0이하일 경우 추천캔슬을 사용할 수 없습니다.';
|
||||
$lang->msg_comment_blamed_cancel_not = '추천수가 0이하일 경우 비추천캔슬을 사용할 수 없습니다.';
|
||||
$lang->msg_cart_is_null = '삭제할 글을 선택해주세요.';
|
||||
$lang->msg_checked_comment_is_deleted = '%d개의 댓글을 삭제했습니다.';
|
||||
$lang->search_target_list['content'] = '내용';
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="point" var="point" filter="number" />
|
||||
<group pipe="and">
|
||||
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
|
||||
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue