Commit 8cc3b795 authored by Robert Lyon's avatar Robert Lyon

Bug 1753359: Force public comments to be moderated

behatnotneeded

Change-Id: I9a43d30dfbf68982cc90c496600ca8c79ef35a7b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 348a9e7c
...@@ -58,7 +58,7 @@ $string['groupadmins'] = 'Group administrators'; ...@@ -58,7 +58,7 @@ $string['groupadmins'] = 'Group administrators';
$string['messageempty'] = 'Your message is empty. Please enter a message or attach a file.'; $string['messageempty'] = 'Your message is empty. Please enter a message or attach a file.';
$string['Moderate'] = 'Moderate'; $string['Moderate'] = 'Moderate';
$string['moderatecomments'] = 'Moderate comments'; $string['moderatecomments'] = 'Moderate comments';
$string['moderatecommentsdescription1'] = 'Comments on pages will remain private until they are approved by you. Comments on individual content, e.g. files and journal entries, are excluded from the moderation.'; $string['moderatecommentsdescription2'] = 'Comments on pages and artefacts remain private until you approve them. Comments by people not logged into their accounts always go into a moderation queue and need to be approved.';
$string['newcommentnotificationsubject'] = 'New comment on %s'; $string['newcommentnotificationsubject'] = 'New comment on %s';
$string['progress_feedback'] = array( $string['progress_feedback'] = array(
'Comment on another user\'s page', 'Comment on another user\'s page',
......
...@@ -1813,7 +1813,7 @@ function add_feedback_form_submit(Pieform $form, $values) { ...@@ -1813,7 +1813,7 @@ function add_feedback_form_submit(Pieform $form, $values) {
// If you're anonymous and your message is moderated or private, then you won't // If you're anonymous and your message is moderated or private, then you won't
// be able to tell what happened to it. So we'll provide some more explanation in // be able to tell what happened to it. So we'll provide some more explanation in
// the comment message. // the comment message.
if ($anonymous && $moderated) { if ($moderated) {
$message = get_string('commentsubmittedmoderatedanon', 'artefact.comment'); $message = get_string('commentsubmittedmoderatedanon', 'artefact.comment');
} }
else if ($anonymous && $private) { else if ($anonymous && $private) {
......
...@@ -180,7 +180,7 @@ $form['elements']['more'] = array( ...@@ -180,7 +180,7 @@ $form['elements']['more'] = array(
'approvecomments' => array( 'approvecomments' => array(
'type' => 'switchbox', 'type' => 'switchbox',
'title' => get_string('moderatecomments', 'artefact.comment'), 'title' => get_string('moderatecomments', 'artefact.comment'),
'description' => get_string('moderatecommentsdescription1', 'artefact.comment'), 'description' => get_string('moderatecommentsdescription2', 'artefact.comment'),
'defaultvalue' => $view->get('approvecomments'), 'defaultvalue' => $view->get('approvecomments'),
), ),
'template' => array( 'template' => array(
......
...@@ -112,7 +112,7 @@ $form['elements']['more'] = array( ...@@ -112,7 +112,7 @@ $form['elements']['more'] = array(
'approvecomments' => array( 'approvecomments' => array(
'type' => 'switchbox', 'type' => 'switchbox',
'title' => get_string('moderatecomments', 'artefact.comment'), 'title' => get_string('moderatecomments', 'artefact.comment'),
'description' => get_string('moderatecommentsdescription1', 'artefact.comment'), 'description' => get_string('moderatecommentsdescription2', 'artefact.comment'),
'defaultvalue' => $view->get('approvecomments'), 'defaultvalue' => $view->get('approvecomments'),
), ),
'template' => array( 'template' => array(
......
...@@ -216,7 +216,7 @@ $inlinejs = "jQuery( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n ...@@ -216,7 +216,7 @@ $inlinejs = "jQuery( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n
// comments if the view is submitted to their group. // comments if the view is submitted to their group.
if (!empty($releaseform) || ($commenttype = $view->user_comments_allowed($USER))) { if (!empty($releaseform) || ($commenttype = $view->user_comments_allowed($USER))) {
$defaultprivate = !empty($releaseform); $defaultprivate = !empty($releaseform);
$moderate = isset($commenttype) && $commenttype === 'private'; $moderate = !$USER->is_logged_in() || (isset($commenttype) && $commenttype === 'private');
$addfeedbackform = pieform(ArtefactTypeComment::add_comment_form($defaultprivate, $moderate)); $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form($defaultprivate, $moderate));
} }
if ($USER->is_logged_in()) { if ($USER->is_logged_in()) {
......
...@@ -105,6 +105,11 @@ Scenario: No private replies to anonymous comments ...@@ -105,6 +105,11 @@ Scenario: No private replies to anonymous comments
And I fill in "Comment" with "Public comment by anonymous user" And I fill in "Comment" with "Public comment by anonymous user"
And I enable the switch "Make comment public" And I enable the switch "Make comment public"
And I press "Comment" And I press "Comment"
# Public comments are now always moderated
When I log in as "AdminA" with password "Kupuh1pa!"
And I go to portfolio page "Page AdminA_01"
And I click on "Make comment public"
And I log out
When I log in as "AdminB" with password "Kupuh1pa!" When I log in as "AdminB" with password "Kupuh1pa!"
And I go to portfolio page "Page AdminA_01" And I go to portfolio page "Page AdminA_01"
And I click on "Reply" in "Public comment by anonymous user" row And I click on "Reply" in "Public comment by anonymous user" row
......
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