Bug 1530106 Comment 51 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This is a slightly simplified version. I noticed that removing the plaintext tag had a bug
https://hg.mozilla.org/comm-central/rev/fca92b0b06929d2a91a677546b1d282fd4d17321
It needs to be done everywhere where you have a HTML editor, but not in a plaintext context. That's why the original patch did:
```
-      if (aHTMLEditor)
-        mailEditor->InsertAsCitedQuotation(mMsgBody, EmptyString(), true,
+      if (aHTMLEditor) {
+        nsAutoString body(mMsgBody);
+        remove_plaintext_tag(body);
+        mailEditor->InsertAsCitedQuotation(body, EmptyString(), true,
                                            getter_AddRefs(nodeInserted));
-      else
+      } else {
         mailEditor->InsertAsQuotation(mMsgBody, getter_AddRefs(nodeInserted));
+      }
     }
```

but only sticking it into the if branch here seems wrong:
https://hg.mozilla.org/comm-central/rev/fca92b0b06929d2a91a677546b1d282fd4d17321#l1.81

Let's correct this now. I've tested reply, forward and "edit as new", but I still don't know why reply works since we're not changing that code patch. I'll investigate that an post my findings into the next comment.
This is a slightly simplified version. I noticed that removing the plaintext tag had a bug
https://hg.mozilla.org/comm-central/rev/fca92b0b06929d2a91a677546b1d282fd4d17321
It needs to be done everywhere where you have a HTML editor, but not in a plaintext context. That's why the original patch did:
```
-      if (aHTMLEditor)
-        mailEditor->InsertAsCitedQuotation(mMsgBody, EmptyString(), true,
+      if (aHTMLEditor) {
+        nsAutoString body(mMsgBody);
+        remove_plaintext_tag(body);
+        mailEditor->InsertAsCitedQuotation(body, EmptyString(), true,
                                            getter_AddRefs(nodeInserted));
-      else
+      } else {
         mailEditor->InsertAsQuotation(mMsgBody, getter_AddRefs(nodeInserted));
+      }
     }
```

but only sticking it into the if branch here seems wrong:
https://hg.mozilla.org/comm-central/rev/fca92b0b06929d2a91a677546b1d282fd4d17321#l1.81

Let's correct this now. I've tested reply, forward and "edit as new", but I still don't know why reply works since we're not changing that code path. I'll investigate that an post my findings into the next comment.

Back to Bug 1530106 Comment 51