Duplicate newlines in forum post notifications if you turn off the HTML editor

Bug #1271420 reported by Aaron Wells on 2014-01-22
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Low
Nigel Cunningham
1.10
Low
Unassigned
15.04
Low
Nigel Cunningham

Bug Description

To replicate:

1. Go to your user account settings and turn the HTML editor off
2. Set the forum post delay to 0 minutes (to make testing quicker)
3. Make a forum post that runs across multiple newlines.
4. Look in your Inbox, and look at the email you receive

Expected result: You should see one newline in the message for each newline in the original post
Actual result: You'll see two newlines in the message for each one in the original post.

This does not seem to happen when the HTML editor (TinyMCE) is active. Possibly TinyMCE strips out the newlines from the text before saving it.

Aaron Wells (u-aaronw) on 2014-01-22
tags: added: forums notifications
Changed in mahara:
milestone: none → 1.9.0
importance: Undecided → Low
status: New → Confirmed
Nigel Cunningham (nigelc-g) wrote :

Diagnosis so far (going home for the day now):

Text comes in as "Test\r\nTest"
Mahara/lib/web.php::format_whitespace (line 3165) changes this to Test<br>\nTest
Mahara/interaction/forum/lib.php:ActivityTypeInteractionForumNewPost->__construct (Line 939) then does

$post->textbody = trim(html2text($post->body));

giving the two "\n"s.

So it looks like format_whitespace needs to just put <br> or just \n... will see tomorrow, Lord willing.

Nigel Cunningham (nigelc-g) wrote :

The attached patch deals with the issue as reported.

That said, turning back on the HTML editor, I've noted that it suffers from the same problem but for an entirely different reason. Given

================
<p>this is a reply</p>
<p>this is a second line of a reply</p>
================

html2text returns

================
this is a reply

this is a second line of a reply
================

So then, should this bug have its scope extended?

Hi Nigel,

Now that you are using Gerrit, can you please put your patch there? :-)

Thanks
Kristina

Aaron Wells (u-aaronw) on 2014-09-10
no longer affects: mahara/1.9

Reviewed: https://reviews.mahara.org/3697
Committed: http://gitorious.org/mahara/mahara/commit/00a049785135ccd5c6f304dc6dbf8168f2cbf33a
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 00a049785135ccd5c6f304dc6dbf8168f2cbf33a
Author: Nigel Cunningham <email address hidden>
Date: Mon Sep 15 15:50:51 2014 +1000

(Bug1271420) Duplicate newlines in forum post notifications if you turn off the HTML editor

This patch fixes an issue wherein duplicate newlines
are created in forum post notifications if you turn off
the HTML editor and create a forum post.

Change-Id: I86be96192b56eaa723641c2b55809303109896f0
Signed-off-by: Nigel Cunningham <email address hidden>

no longer affects: mahara/1.10
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
Aaron Wells (u-aaronw) on 2016-04-28
no longer affects: mahara/16.04
Aaron Wells (u-aaronw) on 2016-04-28
Changed in mahara:
status: In Progress → Invalid
milestone: 16.04.0 → none
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers