Merge pull request #1221 from bjrambo/pr/ncenterlite-user

유저알림 설정에 스크랩 추천 대댓글 알림도 설정옵션 추가
This commit is contained in:
BJRambo 2019-11-30 01:04:46 +09:00 committed by GitHub
commit 8e47758218
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 130 additions and 22 deletions

View file

@ -29,13 +29,17 @@ $lang->ncenterlite_notify_settings = '알림 설정';
$lang->ncenterlite_userconfig_title = '%s님의 알림센터 설정'; $lang->ncenterlite_userconfig_title = '%s님의 알림센터 설정';
$lang->ncenterlite_userconfig_about = '알림센터의 개인의 설정을 저장하도록 합니다.'; $lang->ncenterlite_userconfig_about = '알림센터의 개인의 설정을 저장하도록 합니다.';
$lang->ncenterlite_comment_noti = '댓글 알림'; $lang->ncenterlite_comment_noti = '댓글 알림';
$lang->ncenterlite_comment_noti_about = '내 게시물의 혹은 내 댓글에 댓글이 달릴경우 알림을 받습니다.'; $lang->ncenterlite_comment_noti_about = '내 게시물에 댓글이 달릴 경우 알림을 받습니다.';
$lang->ncenterlite_mention_noti = '멘션 알림'; $lang->ncenterlite_mention_noti = '멘션 알림';
$lang->ncenterlite_mention_noti_about = '누군가 글, 혹은 댓글을 통해서 나를 멘션 했을 경우 알려줍니다. (멘션 방법 @닉네임 )'; $lang->ncenterlite_mention_noti_about = '누군가 글, 혹은 댓글을 통해서 나를 멘션 했을 경우 알림을 받습니다. (멘션 방법 @닉네임 )';
$lang->ncenterlite_message_noti = '쪽지 알림'; $lang->ncenterlite_message_noti = '쪽지 알림';
$lang->ncenterlite_message_noti_about = '누군가에게 받은 쪽지를 알림을 받습니다.'; $lang->ncenterlite_message_noti_about = '누군가에게 받은 쪽지를 알림을 받습니다.';
$lang->ncenterlite_comment_comment_noti = '대댓글 알림'; $lang->ncenterlite_comment_comment_noti = '대댓글 알림';
$lang->ncenterlite_comment_comment_noti_about = '내 댓글에 댓글이 달릴 경우 알림을 받습니다.';
$lang->ncenterlite_vote_noti = '추천 알림'; $lang->ncenterlite_vote_noti = '추천 알림';
$lang->ncenterlite_vote_noti_about = '내 게시글, 혹은 댓글이 추천을 받았을 때 알림을 받습니다.';
$lang->ncenterlite_scrap_noti = '스크랩 알림';
$lang->ncenterlite_scrap_noti_about = '누군가 내 게시글을 스크랩 했을 경우 알림을 받습니다.';
$lang->ncenterlite_activate = '사용'; $lang->ncenterlite_activate = '사용';
$lang->ncenterlite_inactivate = '사용 안함'; $lang->ncenterlite_inactivate = '사용 안함';
$lang->ncenterlite_userconfig_about_warning = '주의! 당신은 관리자 권한으로 다른 사용자의 설정창에 접속하였습니다.'; $lang->ncenterlite_userconfig_about_warning = '주의! 당신은 관리자 권한으로 다른 사용자의 설정창에 접속하였습니다.';

View file

@ -110,6 +110,21 @@ class ncenterlite extends ModuleObject
return true; return true;
} }
if(!$oDB->isColumnExists('ncenterlite_user_set', 'comment_comment_notify'))
{
return true;
}
if(!$oDB->isColumnExists('ncenterlite_user_set', 'vote_notify'))
{
return true;
}
if(!$oDB->isColumnExists('ncenterlite_user_set', 'scrap_notify'))
{
return true;
}
// PK duplicate // PK duplicate
if($oDB->isIndexExists('ncenterlite_notify', 'idx_notify')) if($oDB->isIndexExists('ncenterlite_notify', 'idx_notify'))
{ {
@ -218,6 +233,20 @@ class ncenterlite extends ModuleObject
$oDB->dropIndex('ncenterlite_notify', 'idx_notify'); $oDB->dropIndex('ncenterlite_notify', 'idx_notify');
} }
if(!$oDB->isColumnExists('ncenterlite_user_set','comment_comment_notify'))
{
$oDB->addColumn('ncenterlite_user_set', 'comment_comment_notify', 'char', 1, null, true, 'comment_notify');
}
if(!$oDB->isColumnExists('ncenterlite_user_set','vote_notify'))
{
$oDB->addColumn('ncenterlite_user_set', 'vote_notify', 'char', 1, null, true, 'mention_notify');
}
if(!$oDB->isColumnExists('ncenterlite_user_set','scrap_notify'))
{
$oDB->addColumn('ncenterlite_user_set', 'scrap_notify', 'char', 1, null, true, 'vote_notify');
}
$config = getModel('ncenterlite')->getConfig(); $config = getModel('ncenterlite')->getConfig();
if(!$config) if(!$config)

View file

@ -31,8 +31,11 @@ class ncenterliteController extends ncenterlite
$args = new stdClass(); $args = new stdClass();
$args->member_srl = $member_srl; $args->member_srl = $member_srl;
$args->comment_notify = $obj->comment_notify; $args->comment_notify = $obj->comment_notify;
$args->comment_comment_notify = $obj->comment_comment_notify;
$args->mention_notify = $obj->mention_notify; $args->mention_notify = $obj->mention_notify;
$args->message_notify = $obj->message_notify; $args->message_notify = $obj->message_notify;
$args->vote_notify = $obj->vote_notify;
$args->scrap_notify = $obj->scrap_notify;
if(!$user_config->data) if(!$user_config->data)
{ {
@ -174,7 +177,6 @@ class ncenterliteController extends ncenterlite
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl); $oDocument = $oDocumentModel->getDocument($document_srl);
if($config->comment_all == 'Y' && $obj->member_srl == $oDocument->get('member_srl') && !$obj->parent_srl && (is_array($config->comment_all_notify_module_srls) && in_array($module_info->module_srl, $config->comment_all_notify_module_srls))) if($config->comment_all == 'Y' && $obj->member_srl == $oDocument->get('member_srl') && !$obj->parent_srl && (is_array($config->comment_all_notify_module_srls) && in_array($module_info->module_srl, $config->comment_all_notify_module_srls)))
{ {
$comment_args = new stdClass(); $comment_args = new stdClass();
@ -183,6 +185,10 @@ class ncenterliteController extends ncenterlite
$other_comment = executeQueryArray('ncenterlite.getOtherCommentByMemberSrl', $comment_args); $other_comment = executeQueryArray('ncenterlite.getOtherCommentByMemberSrl', $comment_args);
foreach ($other_comment->data as $value) foreach ($other_comment->data as $value)
{ {
if($config->user_notify_setting == 'Y' && $value->comment_notify === 'N')
{
continue;
}
$args = new stdClass(); $args = new stdClass();
$args->config_type = 'comment_all'; $args->config_type = 'comment_all';
$args->member_srl = $value->member_srl; $args->member_srl = $value->member_srl;
@ -267,27 +273,31 @@ class ncenterliteController extends ncenterlite
{ {
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
$oComment = $oCommentModel->getComment($parent_srl); $oComment = $oCommentModel->getComment($parent_srl);
$member_srl = $oComment->member_srl; $abs_member_srl = abs($oComment->member_srl);
if($config->user_notify_setting == 'Y') if($config->user_notify_setting == 'Y')
{ {
$comment_member_config = $oNcenterliteModel->getUserConfig($member_srl); $comment_member_config = $oNcenterliteModel->getUserConfig($member_srl);
$parent_member_config = $comment_member_config->data; $parent_member_config = $comment_member_config->data;
if($parent_member_config->comment_notify == 'N') if($parent_member_config->comment_comment_notify == 'N')
{ {
return; return;
} }
} }
if(is_array($admin_list) && in_array(abs($member_srl), $admin_list) && isset($config->use['admin_content']) && $obj->admin_comment_notify == true) if(is_array($admin_list) && in_array($abs_member_srl, $admin_list) && isset($config->use['admin_content']) && $obj->admin_comment_notify == true)
{ {
return; return;
} }
if(!in_array(abs($member_srl), $notify_member_srls) && (!Context::get('is_logged') || ($member_srl != 0 && abs($member_srl) != $logged_info->member_srl))) if(!in_array($abs_member_srl, $notify_member_srls) && (!Context::get('is_logged') || ($member_srl != 0 && $abs_member_srl != $logged_info->member_srl)))
{ {
if($oNcenterliteModel->getUserConfig($abs_member_srl)->data->comment_comment_notify == 'N')
{
return;
}
$args = new stdClass(); $args = new stdClass();
$args->config_type = 'comment_comment'; $args->config_type = 'comment_comment';
$args->member_srl = abs($member_srl); $args->member_srl = $abs_member_srl;
$args->srl = $obj->document_srl; $args->srl = $obj->document_srl;
$args->target_p_srl = $parent_srl; $args->target_p_srl = $parent_srl;
$args->target_srl = $obj->comment_srl; $args->target_srl = $obj->comment_srl;
@ -305,22 +315,22 @@ class ncenterliteController extends ncenterlite
{ {
return $output; return $output;
} }
$notify_member_srls[] = abs($member_srl); $notify_member_srls[] = $abs_member_srl;
} }
} }
// 대댓글이 아니고, 게시글의 댓글을 남길 경우 // 대댓글이 아니고, 게시글의 댓글을 남길 경우
if(!$parent_srl || ($parent_srl && isset($config->use['comment_comment']))) if(!$parent_srl || ($parent_srl && isset($config->use['comment_comment'])))
{ {
$member_srl = $oDocument->get('member_srl'); $abs_member_srl = abs($oDocument->get('member_srl'));
if(is_array($admin_list) && in_array(abs($member_srl), $admin_list) && isset($config->use['admin_content']) && $obj->admin_comment_notify == true) if(is_array($admin_list) && in_array($abs_member_srl, $admin_list) && isset($config->use['admin_content']) && $obj->admin_comment_notify == true)
{ {
return; return;
} }
if($config->user_notify_setting == 'Y') if($config->user_notify_setting == 'Y')
{ {
$comment_member_config = $oNcenterliteModel->getUserConfig($member_srl); $comment_member_config = $oNcenterliteModel->getUserConfig($abs_member_srl);
$document_comment_member_config = $comment_member_config->data; $document_comment_member_config = $comment_member_config->data;
if($document_comment_member_config->comment_notify == 'N') if($document_comment_member_config->comment_notify == 'N')
{ {
@ -328,11 +338,11 @@ class ncenterliteController extends ncenterlite
} }
} }
if(!in_array(abs($member_srl), $notify_member_srls) && (!$logged_info || ($member_srl != 0 && abs($member_srl) != $logged_info->member_srl))) if(!in_array($abs_member_srl, $notify_member_srls) && (!$logged_info || ($member_srl != 0 && $abs_member_srl != $logged_info->member_srl)))
{ {
$args = new stdClass(); $args = new stdClass();
$args->config_type = 'comment'; $args->config_type = 'comment';
$args->member_srl = abs($member_srl); $args->member_srl = $abs_member_srl;
$args->srl = $document_srl; $args->srl = $document_srl;
$args->target_p_srl = $comment_srl; $args->target_p_srl = $comment_srl;
$args->target_srl = $comment_srl; $args->target_srl = $comment_srl;
@ -409,6 +419,11 @@ class ncenterliteController extends ncenterlite
return; return;
} }
if($config->user_notify_setting == 'Y' && $oNcenterliteModel->getUserConfig($obj->target_member_srl)->data->scrap_notify == 'N')
{
return;
}
$args = new stdClass(); $args = new stdClass();
$args->config_type = 'scrap'; $args->config_type = 'scrap';
$args->target_member_srl = $obj->member_srl; $args->target_member_srl = $obj->member_srl;
@ -442,6 +457,11 @@ class ncenterliteController extends ncenterlite
return; return;
} }
if($config->user_notify_setting == 'Y' && $oNcenterliteModel->getUserConfig($obj->member_srl)->data->vote_notify == 'N')
{
return;
}
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($obj->document_srl, false, false); $oDocument = $oDocumentModel->getDocument($obj->document_srl, false, false);
@ -477,6 +497,11 @@ class ncenterliteController extends ncenterlite
return; return;
} }
if($config->user_notify_setting == 'Y' && $oNcenterliteModel->getUserConfig($obj->member_srl)->data->vote_notify == 'N')
{
return;
}
$oCommentModel = new commentModel(); $oCommentModel = new commentModel();
$oComment = $oCommentModel->getComment($obj->comment_srl); $oComment = $oCommentModel->getComment($obj->comment_srl);

View file

@ -1,15 +1,21 @@
<query id="getOtherCommentByMemberSrl" action="select"> <query id="getOtherCommentByMemberSrl" action="select">
<tables> <tables>
<table name="comments" /> <table name="comments" />
<table name="ncenterlite_user_set" type="left outer join">
<conditions>
<condition operation="equal" column="ncenterlite_user_set.member_srl" default="comments.member_srl" />
</conditions>
</table>
</tables> </tables>
<columns> <columns>
<column name="member_srl" /> <column name="comments.member_srl" alias="member_srl" />
<column name="ncenterlite_user_set.comment_notify" alias="comment_notify" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="document_srl" var="document_srl" notnull="notnull" /> <condition operation="equal" column="comments.document_srl" var="document_srl" notnull="notnull" />
<condition operation="notequal" column="member_srl" var="member_srl" notnull="notnull" pipe="and" /> <condition operation="notequal" column="comments.member_srl" var="member_srl" notnull="notnull" pipe="and" />
</conditions> </conditions>
<groups> <groups>
<group column="member_srl" /> <group column="member_srl" />

View file

@ -5,7 +5,10 @@
<columns> <columns>
<column name="member_srl" var="member_srl" notnull="notnull" /> <column name="member_srl" var="member_srl" notnull="notnull" />
<column name="comment_notify" var="comment_notify" notnull="notnull" /> <column name="comment_notify" var="comment_notify" notnull="notnull" />
<column name="comment_comment_notify" var="comment_comment_notify" notnull="notnull" />
<column name="mention_notify" var="mention_notify" notnull="notnull" /> <column name="mention_notify" var="mention_notify" notnull="notnull" />
<column name="vote_notify" var="vote_notify" notnull="notnull" />
<column name="scrap_notify" var="scrap_notify" notnull="notnull" />
<column name="message_notify" var="message_notify" notnull="notnull" /> <column name="message_notify" var="message_notify" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" /> <column name="regdate" var="regdate" default="curdate()" />
</columns> </columns>

View file

@ -4,7 +4,10 @@
</tables> </tables>
<columns> <columns>
<column name="comment_notify" var="comment_notify" notnull="notnull" /> <column name="comment_notify" var="comment_notify" notnull="notnull" />
<column name="comment_comment_notify" var="comment_comment_notify" notnull="notnull" />
<column name="mention_notify" var="mention_notify" notnull="notnull" /> <column name="mention_notify" var="mention_notify" notnull="notnull" />
<column name="vote_notify" var="vote_notify" notnull="notnull" />
<column name="scrap_notify" var="scrap_notify" notnull="notnull" />
<column name="message_notify" var="message_notify" notnull="notnull" /> <column name="message_notify" var="message_notify" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" /> <column name="regdate" var="regdate" default="curdate()" />
</columns> </columns>

View file

@ -1,7 +1,10 @@
<table name="ncenterlite_user_set"> <table name="ncenterlite_user_set">
<column name="member_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" brief="member_srl 고유맴버 번호" /> <column name="member_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" brief="member_srl 고유맴버 번호" />
<column name="comment_notify" type="char" size="1" notnull="notnull" /> <column name="comment_notify" type="char" size="1" notnull="notnull" />
<column name="comment_comment_notify" type="char" size="1" notnull="notnull" />
<column name="mention_notify" type="char" size="1" notnull="notnull" /> <column name="mention_notify" type="char" size="1" notnull="notnull" />
<column name="vote_notify" type="char" size="1" notnull="notnull" />
<column name="scrap_notify" type="char" size="1" notnull="notnull" />
<column name="message_notify" type="char" size="1" notnull="notnull" /> <column name="message_notify" type="char" size="1" notnull="notnull" />
<column name="regdate" type="date" index="idx_regdate" /> <column name="regdate" type="date" index="idx_regdate" />
</table> </table>

View file

@ -24,7 +24,7 @@
<label class="control-label">{$lang->ncenterlite_comment_noti}</label> <label class="control-label">{$lang->ncenterlite_comment_noti}</label>
<div class="controls"> <div class="controls">
<label class="inline"> <label class="inline">
<input type="radio" name="comment_notify" value="Y" checked="checked"|cond="$user_config->comment_notify == 'Y'" /> {$lang->ncenterlite_activate} <input type="radio" name="comment_notify" value="Y" checked="checked"|cond="$user_config->comment_notify != 'N'" /> {$lang->ncenterlite_activate}
</label> </label>
<label class="inline"> <label class="inline">
<input type="radio" name="comment_notify" value="N" checked="checked"|cond="$user_config->comment_notify == 'N'" /> {$lang->ncenterlite_inactivate} <input type="radio" name="comment_notify" value="N" checked="checked"|cond="$user_config->comment_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -36,7 +36,7 @@
<label class="control-label">{$lang->ncenterlite_mention_noti}</label> <label class="control-label">{$lang->ncenterlite_mention_noti}</label>
<div class="controls"> <div class="controls">
<label class="inline"> <label class="inline">
<input type="radio" name="mention_notify" value="Y" checked="checked"|cond="$user_config->mention_notify == 'Y'" /> {$lang->ncenterlite_activate} <input type="radio" name="mention_notify" value="Y" checked="checked"|cond="$user_config->mention_notify != 'N'" /> {$lang->ncenterlite_activate}
</label> </label>
<label class="inline"> <label class="inline">
<input type="radio" name="mention_notify" value="N" checked="checked"|cond="$user_config->mention_notify == 'N'" /> {$lang->ncenterlite_inactivate} <input type="radio" name="mention_notify" value="N" checked="checked"|cond="$user_config->mention_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -48,7 +48,7 @@
<label class="control-label">{$lang->ncenterlite_message_noti}</label> <label class="control-label">{$lang->ncenterlite_message_noti}</label>
<div class="controls"> <div class="controls">
<label class="inline"> <label class="inline">
<input type="radio" name="message_notify" value="Y" checked="checked"|cond="$user_config->message_notify == 'Y'" /> {$lang->ncenterlite_activate} <input type="radio" name="message_notify" value="Y" checked="checked"|cond="$user_config->message_notify != 'N'" /> {$lang->ncenterlite_activate}
</label> </label>
<label class="inline"> <label class="inline">
<input type="radio" name="message_notify" value="N" checked="checked"|cond="$user_config->message_notify == 'N'" /> {$lang->ncenterlite_inactivate} <input type="radio" name="message_notify" value="N" checked="checked"|cond="$user_config->message_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -56,7 +56,42 @@
<p class="help-block">{$lang->ncenterlite_message_noti_about}</p> <p class="help-block">{$lang->ncenterlite_message_noti_about}</p>
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_vote_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="vote_notify" value="Y" checked="checked"|cond="$user_config->vote_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="vote_notify" value="N" checked="checked"|cond="$user_config->vote_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_vote_noti_about}</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_scrap_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="scrap_notify" value="Y" checked="checked"|cond="$user_config->scrap_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="scrap_notify" value="N" checked="checked"|cond="$user_config->scrap_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_scrap_noti_about}</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_comment_comment_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="comment_comment_notify" value="Y" checked="checked"|cond="$user_config->comment_comment_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="comment_comment_notify" value="N" checked="checked"|cond="$user_config->comment_comment_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_comment_comment_noti_about}</p>
</div>
</div>
</section> </section>
<div class="clearfix btnArea"> <div class="clearfix btnArea">
<div class="pull-right"> <div class="pull-right">