Commit a1719bbd authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review

Merge "Bug 1460368: stopping anonymous comments on artefacts"

parents 1aef6b75 3046c5c7
......@@ -146,7 +146,7 @@ EOF;
$javascript = array('paginator', 'viewmenu', 'expandable');
$extrastylesheets = array('style/views.css');
if ($artefact->get('allowcomments')) {
if ($artefact->get('allowcomments') && ( $USER->is_logged_in() || (!$USER->is_logged_in() && get_config('anonymouscomments')))) {
$addfeedbackform = pieform(ArtefactTypeComment::add_comment_form(false, $artefact->get('approvecomments')));
$extrastylesheets[] = 'style/jquery.rating.css';
$javascript[] = 'jquery.rating';
......
......@@ -523,6 +523,8 @@ class ArtefactTypeComment extends ArtefactType {
* or the html to render them.
*/
public function get_artefact_comments_for_view(ArtefactType $artefact, $view, $blockid, $html = true, $editing = false) {
global $USER;
if (!is_object($artefact) || !is_object($view)) {
throw new MaharaException('we do not have the right information to display the comments');
}
......@@ -549,6 +551,7 @@ class ArtefactTypeComment extends ArtefactType {
$smarty->assign('comments', $comments);
$smarty->assign('editing', $editing);
$smarty->assign('allowcomments', $artefact->get('allowcomments'));
$smarty->assign('allowcommentsadd', ($artefact->get('allowcomments') && ( $USER->is_logged_in() || (!$USER->is_logged_in() && get_config('anonymouscomments')))));
$render = $smarty->fetch('artefact/artefactcommentsview.tpl');
return array($commentcount, $render);
}
......
......@@ -8,7 +8,7 @@
<span id='block_{$blockid}' class="nocomments">{str tag=Comments section=artefact.comment} ({$commentcount})</span>
{/if}
{/if}
{if $allowcomments}
{if $allowcommentsadd}
{if !$editing}
<a class="addcomment bar-before" href="{$artefacturl}">{str tag=addcomment section=artefact.comment}</a>
{/if}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment