Skip to content

Fix: Display correct line breaks in emails

What does this MR do?

MR !1317 (merged) led to HTML mails not beeing displayed correctly. This MR fixed that by checking if mails contain HTML before adding br tags.

How confident are you it won't break things if deployed?

Very.

Links to related issues

https://yunity.slack.com/archives/C74JC2V26/p1580423034052400

How to test

Steps a reviewer can take to verify that this MR does what it says it does e.g.

  1. Add an incoming mail, e.g. with the following SQL statement (you'll need to adjust mailbox_id), or by sending an HTML mail and then moving it to folder 1.
INSERT INTO `fs_mailbox_message` (`id`, `mailbox_id`, `folder`, `sender`, `to`, `subject`, `body`, `body_html`, `time`, `attach`, `read`, `answer`) VALUES (NULL, '28548', '1', '{\"host\":\"foodsharing.network\",\"mailbox\":\"b.fuchs\",\"personal\":\"Bot Fuchs\"}', '[{\"personal\":\"a@example.com\",\"mailbox\":\"a\",\"host\":\"example.com\"}]', 'Mail mit HTML', 'empty', '<html>\r\n<div>\r\n <p>\r\n This\r\n should\r\n be\r\n only\r\n one\r\n line\r\n </p>\r\n</div>\r\n</html>', '2020-02-02 22:50:20', '', '1', '0') 
  1. Checkout branch
  2. Login as bot, go to inbox, open mail
  3. Text in mail should be in one line (or look not broken, depending on the HTML in mail :) )

Screenshots (if applicable)

Before fix: Bildschirmfoto_2020-02-02_um_22.58.12

After fix: Bildschirmfoto_2020-02-02_um_22.59.42

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings

Merge request reports