Commit 3046c5c7 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1460368: stopping anonymous comments on artefacts



When anonymous comments is turned off

Change-Id: Id2ed84cb3b532da6ec8e117ef13c283bd64af302
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent cb1da444
...@@ -146,7 +146,7 @@ EOF; ...@@ -146,7 +146,7 @@ EOF;
$javascript = array('paginator', 'viewmenu', 'expandable'); $javascript = array('paginator', 'viewmenu', 'expandable');
$extrastylesheets = array('style/views.css'); $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'))); $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form(false, $artefact->get('approvecomments')));
$extrastylesheets[] = 'style/jquery.rating.css'; $extrastylesheets[] = 'style/jquery.rating.css';
$javascript[] = 'jquery.rating'; $javascript[] = 'jquery.rating';
......
...@@ -523,6 +523,8 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -523,6 +523,8 @@ class ArtefactTypeComment extends ArtefactType {
* or the html to render them. * or the html to render them.
*/ */
public function get_artefact_comments_for_view(ArtefactType $artefact, $view, $blockid, $html = true, $editing = false) { public function get_artefact_comments_for_view(ArtefactType $artefact, $view, $blockid, $html = true, $editing = false) {
global $USER;
if (!is_object($artefact) || !is_object($view)) { if (!is_object($artefact) || !is_object($view)) {
throw new MaharaException('we do not have the right information to display the comments'); throw new MaharaException('we do not have the right information to display the comments');
} }
...@@ -549,6 +551,7 @@ class ArtefactTypeComment extends ArtefactType { ...@@ -549,6 +551,7 @@ class ArtefactTypeComment extends ArtefactType {
$smarty->assign('comments', $comments); $smarty->assign('comments', $comments);
$smarty->assign('editing', $editing); $smarty->assign('editing', $editing);
$smarty->assign('allowcomments', $artefact->get('allowcomments')); $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'); $render = $smarty->fetch('artefact/artefactcommentsview.tpl');
return array($commentcount, $render); return array($commentcount, $render);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<span id='block_{$blockid}' class="nocomments">{str tag=Comments section=artefact.comment} ({$commentcount})</span> <span id='block_{$blockid}' class="nocomments">{str tag=Comments section=artefact.comment} ({$commentcount})</span>
{/if} {/if}
{/if} {/if}
{if $allowcomments} {if $allowcommentsadd}
{if !$editing} {if !$editing}
<a class="addcomment bar-before" href="{$artefacturl}">{str tag=addcomment section=artefact.comment}</a> <a class="addcomment bar-before" href="{$artefacturl}">{str tag=addcomment section=artefact.comment}</a>
{/if} {/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