Merge pull request #2172 from bjrambo/pr/notify_trash_comment

휴지통으로 댓글을 이동할 때 알림 삭제기능 추가
This commit is contained in:
Kijin Sung 2023-08-31 00:41:20 +09:00 committed by GitHub
commit 081af5fbb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 0 deletions

View file

@ -29,6 +29,7 @@ class ncenterlite extends ModuleObject
array('member.procMemberScrapDocument', 'ncenterlite', 'controller', 'triggerAfterScrap', 'after'),
array('moduleHandler.init', 'ncenterlite', 'controller', 'triggerAddMemberMenu', 'after'),
array('document.moveDocumentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrash', 'after'),
array('comment.moveCommentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrashComment', 'after'),
array('comment.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCount', 'after'),
array('comment.updateVotedCountCancel', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCancel', 'after'),
// 2020. 05. 30 add menu when popup document menu called

View file

@ -938,6 +938,38 @@ class ncenterliteController extends ncenterlite
}
}
function triggerAfterMoveToTrashComment($obj)
{
$notify_list = ncenterliteModel::getInstance()->getNotifyListByCommentSrl($obj->document_srl, $obj->comment_srl);
$member_srls = array();
foreach($notify_list as $value)
{
if(!in_array($value->member_srl, $member_srls))
{
$member_srls[] = $value->member_srl;
}
}
$config = NcenterliteModel::getConfig();
if(empty($config->use))
{
return;
}
$args = new stdClass();
$args->srl = $obj->comment_srl;
$output = executeQuery('ncenterlite.deleteNotifyBySrl', $args);
if($output->toBool())
{
foreach($member_srls as $member_srl)
{
//Remove flag files
$this->removeFlagFile($member_srl);
}
}
}
function triggerAfterModuleHandlerProc(&$oModule)
{
$args = new stdClass();

View file

@ -755,6 +755,24 @@ class ncenterliteModel extends ncenterlite
return $output->data;
}
function getNotifyListByCommentSrl($document_srl, $comment_srl)
{
if($comment_srl === null)
{
return false;
}
$args = new stdClass();
$args->document_srl = $document_srl;
$args->comment_srl = $comment_srl;
$output = executeQueryArray('ncenterlite.getNotifyListByCommentSrl', $args);
if(!$output->toBool())
{
return $output;
}
return $output->data;
}
/**
* 알림에서 member_srl 정리해서 보내준다.
* @param int $srl

View file

@ -0,0 +1,12 @@
<query id="getNotifyListByCommentSrl" action="select">
<tables>
<table name="ncenterlite_notify" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="srl" var="document_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="target_srl" var="comment_srl" filter="number" notnull="notnull" />
</conditions>
</query>