summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-12-12 06:06:41 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-12-12 06:06:41 +0000
commitfcde99a4ddfde3c725b10454ba575d82c8cc7aa1 (patch)
treeff32939689ef683b5ad2a9994cdbf9dbea2fe078 /modules/comment/comment.module
parent4610499856e854ad9c9fcb4fa01081d952a2fa5f (diff)
downloadbrdo-fcde99a4ddfde3c725b10454ba575d82c8cc7aa1.tar.gz
brdo-fcde99a4ddfde3c725b10454ba575d82c8cc7aa1.tar.bz2
#60916: Fix comment subject being empty when comment only contains HTML tags.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 865b4560f..7445ca618 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1545,9 +1545,15 @@ function _comment_form_submit($form_values) {
// 1) Filter it into HTML
// 2) Strip out all HTML tags
// 3) Convert entities back to plain-text.
- // Note: format is checked by check_markup().
- $form_values['subject'] = truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE);
+ // Note: format is checked by check_markup().
+ $form_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE));
+ // Edge cases where the comment body is populated only by HTML tags will
+ // require a default subject.
+ if ($form_values['subject'] == '') {
+ $form_values['subject'] = t('(No subject)');
+ }
}
+
return $form_values;
}