Commit 9e1e4583 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

comments: prevent empty comments submission

Empty comment message is only allowed if the file has been attached.

Signed-off-by: default avatarRuslan Kabalin <>
parent b4d724d5
......@@ -64,6 +64,7 @@ $string['makepublicrequestsubject'] = 'Request to change private comment to publ
$string['makepublicrequestbyauthormessage'] = '%s has requested that you make their comment public.';
$string['makepublicrequestbyownermessage'] = '%s has requested that you make your comment public.';
$string['makepublicrequestsent'] = 'A message has been sent to %s to request that the comment be made public.';
$string['messageempty'] = 'Message is empty. Empty message is only allowed if you attached the file.';
$string['Moderate'] = 'Moderate';
$string['moderatecomments'] = 'Moderate comments';
$string['moderatecommentsdescription'] = 'Comments will remain private until they are approved by you.';
......@@ -768,6 +768,9 @@ function add_feedback_form_validate(Pieform $form, $values) {
$form->set_error('message', $msg);
if (empty($values['attachments']) && empty($values['message'])) {
$form->set_error('message', get_string('messageempty', 'artefact.comment'));
function add_feedback_form_submit(Pieform $form, $values) {
Supports Markdown
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