Skip to content

Commit 880618f

Browse files
committed
fixup! fixup! TW-2145: Update condition for mapping formatted_body
1 parent 65170bb commit 880618f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/src/room.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,13 +673,17 @@ class Room {
673673
final html = markdown(event['body'],
674674
getEmotePacks: () => getImagePacksFlat(ImagePackUsage.emoticon),
675675
getMention: getMention);
676+
677+
final formatText = event['body']
678+
.toString()
679+
.trim()
680+
.replaceAll(RegExp(r'(<br />)+$'), '')
681+
.convertLinebreaksToBr()
682+
.replaceAll(RegExp(r'<br />\n?'), '\n');
683+
676684
// if the decoded html is the same as the body, there is no need in sending a formatted message
677685
if (HtmlUnescape().convert(html.replaceAll(RegExp(r'<br />\n?'), '\n')) !=
678-
event['body']
679-
.toString()
680-
.trim()
681-
.replaceAll(RegExp(r'(<br />)+$'), '')
682-
.convertLinebreaksToBr()) {
686+
formatText) {
683687
event['format'] = 'org.matrix.custom.html';
684688
event['formatted_body'] = html;
685689
}

0 commit comments

Comments
 (0)