diff --git a/htdocs/interaction/forum/lib.php b/htdocs/interaction/forum/lib.php index 306aa6a..7d0cd15 100644 --- a/htdocs/interaction/forum/lib.php +++ b/htdocs/interaction/forum/lib.php @@ -936,7 +936,14 @@ class ActivityTypeInteractionForumNewPost extends ActivityTypePlugin { // they are left empty. Use html2text instead. $this->message = str_shorten_text(trim(html2text($post->body)), 200, true); // For internal notifications. - $post->textbody = trim(html2text($post->body)); + if (is_html_editor_enabled()) { + $post->textbody = trim(html2text($post->body)); + } else { + // The post had a single \n converted to
\n in Mahara/lib/web.php::format_whitespace (line 3165) + // If we just call html2text directly, we'll end up with 2 newlines. To avoid this, strip the
tags, + // giving the original contents. + $post->textbody = str_replace('
', '', $post->body); + } $post->htmlbody = clean_html($post->body); $this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid; @@ -1049,7 +1056,14 @@ class ActivityTypeInteractionForumReportPost extends ActivityTypePlugin { $this->fromuser = $this->reporter; $post->posttime = strftime(get_string('strftimedaydatetime'), $post->ctime); - $post->textbody = trim(html2text($post->body)); + if (is_html_editor_enabled()) { + $post->textbody = trim(html2text($post->body)); + } else { + // The post had a single \n converted to
\n in Mahara/lib/web.php::format_whitespace (line 3165) + // If we just call html2text directly, we'll end up with 2 newlines. To avoid this, strip the
tags, + // giving the original contents. + $post->textbody = str_replace('
', '', $post->body); + } $post->htmlbody = clean_html($post->body); $this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid;