Commit fb950eec authored by Aaron Wells's avatar Aaron Wells
Browse files

Providing a more specific message for anonymous commenters of private comments

Bug1201052

Change-Id: I10dd1f28eb7b47d7608f9df29a4661300a99e4fb
parent 5e2f3e6d
...@@ -59,6 +59,8 @@ $string['feedbackattachdirdesc'] = 'Files attached to comments on your portfolio ...@@ -59,6 +59,8 @@ $string['feedbackattachdirdesc'] = 'Files attached to comments on your portfolio
$string['feedbackattachmessage'] = 'The attached file(s) have been added to your %s folder'; $string['feedbackattachmessage'] = 'The attached file(s) have been added to your %s folder';
$string['feedbackonviewbyuser'] = 'Feedback on %s by %s'; $string['feedbackonviewbyuser'] = 'Feedback on %s by %s';
$string['feedbacksubmitted'] = 'Feedback submitted'; $string['feedbacksubmitted'] = 'Feedback submitted';
$string['feedbacksubmittedmoderatedanon'] = 'Feedback submitted, awaiting moderation';
$string['feedbacksubmittedprivateanon'] = 'Private feedback submitted';
$string['lastcomment'] = 'Last comment'; $string['lastcomment'] = 'Last comment';
$string['makepublic'] = 'Make public'; $string['makepublic'] = 'Make public';
$string['makepublicnotallowed'] = 'You are not allowed to make this comment public'; $string['makepublicnotallowed'] = 'You are not allowed to make this comment public';
......
...@@ -993,19 +993,24 @@ function add_feedback_form_submit(Pieform $form, $values) { ...@@ -993,19 +993,24 @@ function add_feedback_form_submit(Pieform $form, $values) {
} }
if ($author = $USER->get('id')) { if ($author = $USER->get('id')) {
$anonymous = false;
$data->author = $author; $data->author = $author;
} }
else { else {
$anonymous = true;
$data->authorname = $values['authorname']; $data->authorname = $values['authorname'];
} }
if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) { if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) {
$data->private = 1; $data->private = 1;
$data->requestpublic = 'author'; $data->requestpublic = 'author';
$moderated = true;
} }
else { else {
$data->private = (int) !$values['ispublic']; $data->private = (int) !$values['ispublic'];
$moderated = false;
} }
$private = $data->private;
if (get_config('licensemetadata')) { if (get_config('licensemetadata')) {
$data->license = $values['license']; $data->license = $values['license'];
...@@ -1124,8 +1129,21 @@ function add_feedback_form_submit(Pieform $form, $values) { ...@@ -1124,8 +1129,21 @@ function add_feedback_form_submit(Pieform $form, $values) {
$newlist = ArtefactTypeComment::get_comments(10, 0, 'last', $view, $artefact); $newlist = ArtefactTypeComment::get_comments(10, 0, 'last', $view, $artefact);
// 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
// the feedback message.
if ($anonymous && $moderated) {
$message = get_string('feedbacksubmittedmoderatedanon', 'artefact.comment');
}
else if ($anonymous && $private) {
$message = get_string('feedbacksubmittedprivateanon', 'artefact.comment');
}
else {
$message = get_string('feedbacksubmitted', 'artefact.comment');
}
$form->reply(PIEFORM_OK, array( $form->reply(PIEFORM_OK, array(
'message' => get_string('feedbacksubmitted', 'artefact.comment'), 'message' => $message,
'goto' => $goto, 'goto' => $goto,
'data' => $newlist, 'data' => $newlist,
)); ));
......
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