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

Bug #1271420 reported by Aaron Wells
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Invalid
Low
Nigel Cunningham
1.10
Fix Released
Low
Unassigned
15.04
Fix Released
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)
tags: added: forums notifications
Changed in mahara:
milestone: none → 1.9.0
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
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.

Revision history for this message
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?

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Nigel,

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

Thanks
Kristina

Aaron Wells (u-aaronw)
no longer affects: mahara/1.9
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3697

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

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)
Changed in mahara:
status: Fix Committed → Fix Released
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/5942

Aaron Wells (u-aaronw)
no longer affects: mahara/16.04
Aaron Wells (u-aaronw)
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.