Hide vote/blame log if respective setting is disabled #2523

This commit is contained in:
Kijin Sung 2025-03-14 01:37:51 +09:00
parent bb3ea5c9aa
commit 3f553d4d9c
2 changed files with 24 additions and 4 deletions

View file

@ -1523,6 +1523,12 @@ class BoardView extends Board
throw new Rhymix\Framework\Exception('msg_not_target');
}
$features = Rhymix\Modules\Board\Models\Features::fromModuleInfo($this->module_info);
if (!$features->{$target}->vote_log)
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
}
$output = executeQueryArray($queryId, $args);
if(!$output->toBool())
{
@ -1537,7 +1543,11 @@ class BoardView extends Board
{
if($log->point > 0)
{
if($log->member_srl == $vote_member_infos[$log->member_srl]->member_srl)
if (isset($vote_member_infos[$log->member_srl]))
{
continue;
}
if (!$features->{$target}->vote_up_log)
{
continue;
}
@ -1545,7 +1555,11 @@ class BoardView extends Board
}
else
{
if($log->member_srl == $blame_member_infos[$log->member_srl]->member_srl)
if (isset($blame_member_infos[$log->member_srl]))
{
continue;
}
if (!$features->{$target}->vote_down_log)
{
continue;
}
@ -1553,6 +1567,8 @@ class BoardView extends Board
}
}
}
Context::set('board_features', $features);
Context::set('vote_member_info', $vote_member_infos);
Context::set('blame_member_info', $blame_member_infos);
$this->setTemplateFile('vote_log');

View file

@ -61,8 +61,10 @@ class Features
// Document features
$features->document->vote_up = ($document_config->use_vote_up ?? 'Y') !== 'N';
$features->document->vote_up_log = ($document_config->use_vote_up ?? 'Y') === 'S';
$features->document->vote_down = ($document_config->use_vote_down ?? 'Y') !== 'N';
$features->document->vote_log = ($document_config->use_vote_up ?? 'Y') === 'S' || ($document_config->use_vote_down ?? 'Y') === 'S';
$features->document->vote_down_log = ($document_config->use_vote_down ?? 'Y') === 'S';
$features->document->vote_log = $features->document->vote_up_log || $features->document->vote_down_log;
if (isset($document_config->allow_vote_cancel))
{
$features->document->cancel_vote = $document_config->allow_vote_cancel === 'Y';
@ -92,8 +94,10 @@ class Features
// Comment features
$features->comment->vote_up = ($comment_config->use_vote_up ?? 'Y') !== 'N';
$features->comment->vote_up_log = ($comment_config->use_vote_up ?? 'Y') === 'S';
$features->comment->vote_down = ($comment_config->use_vote_down ?? 'Y') !== 'N';
$features->comment->vote_log = ($comment_config->use_vote_up ?? 'Y') === 'S' || ($comment_config->use_vote_down ?? 'Y') === 'S';
$features->comment->vote_down_log = ($comment_config->use_vote_down ?? 'Y') === 'S';
$features->comment->vote_log = $features->comment->vote_up_log || $features->comment->vote_down_log;
if (isset($comment_config->allow_vote_cancel))
{
$features->comment->cancel_vote = $comment_config->allow_vote_cancel === 'Y';