diff options
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/actions/notifications.js | 2 | ||||
-rw-r--r-- | app/javascript/mastodon/components/status_content.js | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 323e2e9b6..da3d562d5 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -53,7 +53,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) { // Desktop notifications if (typeof window.Notification !== 'undefined' && showAlert) { const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username }); - const body = (notification.status && notification.status.spoiler_text.length > 0) ? unescapeHTML(notification.status.spoiler_text) : unescapeHTML(notification.status ? notification.status.content : ''); + const body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : ''); const notify = new Notification(title, { body, icon: notification.account.avatar, tag: notification.id }); notify.addEventListener('click', () => { diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js index f7d6b750f..c51f85d10 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/mastodon/components/status_content.js @@ -93,7 +93,7 @@ class StatusContent extends React.PureComponent { const { hidden } = this.state; const content = { __html: emojify(status.get('content')) }; - const spoilerContent = { __html: emojify(status.get('spoiler_text', '')) }; + const spoilerContent = { __html: emojify(escapeTextContentForBrowser(status.get('spoiler_text', ''))) }; const directionStyle = { direction: 'ltr' }; if (isRtl(status.get('content'))) { @@ -116,19 +116,16 @@ class StatusContent extends React.PureComponent { } return ( - <div - ref={this.setRef} - className='status__content' - onMouseDown={this.handleMouseDown} - onMouseUp={this.handleMouseUp} - > + <div className='status__content' ref={this.setRef} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}> <p style={{ marginBottom: hidden && status.get('mentions').size === 0 ? '0px' : '' }} > <span dangerouslySetInnerHTML={spoilerContent} /> <button tabIndex='0' className='status__content__spoiler-link' onClick={this.handleSpoilerClick}>{toggleText}</button> + </p> {mentionsPlaceholder} <div style={{ display: hidden ? 'none' : 'block', ...directionStyle }} dangerouslySetInnerHTML={content} /> + </div> ); } else if (this.props.onClick) { |