]> cat aescling's git repositories - mastodon.git/commitdiff
Fix #1609, fix #1628 - Revert #1397 (#1700)
authorEugen <eugen@zeonfederated.com>
Thu, 13 Apr 2017 17:23:36 +0000 (19:23 +0200)
committerGitHub <noreply@github.com>
Thu, 13 Apr 2017 17:23:36 +0000 (19:23 +0200)
When transmitting data in a HTML-encoded element like <content type="html" />,
relying on newlines being preserved is not wise, since HTML by itself
does not care for newlines - it cares for <p> and <br>

Additional fix: reset NSFW toggle after sending toot

app/assets/javascripts/components/components/status_content.jsx
app/assets/javascripts/components/reducers/compose.jsx
app/lib/formatter.rb

index 9cf03bb32568f98d93b474393a05e4d7495142ad..c7eefcaf508fd00080f5b5910251d6aaf16d899b 100644 (file)
@@ -92,7 +92,7 @@ const StatusContent = React.createClass({
     const { status } = this.props;
     const { hidden } = this.state;
 
-    const content = { __html: emojify(status.get('content')).replace(/\n/g, '') };
+    const content = { __html: emojify(status.get('content')) };
     const spoilerContent = { __html: emojify(escapeTextContentForBrowser(status.get('spoiler_text', ''))) };
     const directionStyle = { direction: 'ltr' };
 
index 86974239bee4b8c01efdabce8f300048a6e0de62..7349cc351d46d10d77582faaae775e1dc60b9b7d 100644 (file)
@@ -67,6 +67,7 @@ function clearAll(state) {
     map.set('is_submitting', false);
     map.set('in_reply_to', null);
     map.set('privacy', state.get('default_privacy'));
+    map.set('sensitive', false);
     map.update('media_attachments', list => list.clear());
   });
 };
index b6d371ed2d6a14fa8b8087dd2f7c1a6a02df4f50..64349e68ebcc011b68d448a6720078f978fa88a5 100644 (file)
@@ -15,6 +15,7 @@ class Formatter
     html = status.text
     html = encode(html)
     html = simple_format(html, {}, sanitize: false)
+    html = html.gsub(/\n/, '')
     html = link_urls(html)
     html = link_mentions(html, status.mentions)
     html = link_hashtags(html)