untested!! spoiler hotfix for replies

untested, my vagrant is bugged again, submitted at gargron's request
This commit is contained in:
hoodie 2017-02-04 17:33:46 -05:00
parent 9bd2b6be86
commit 8d6aa92b5e
2 changed files with 9 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
import escapeTextContentForBrowser from 'react/lib/escapeTextContentForBrowser'; import escapeTextContentForBrowser from 'react/lib/escapeTextContentForBrowser';
import emojify from '../emoji'; import emojify from '../emoji';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Permalink from './permalink';
const spoilerStyle = { const spoilerStyle = {
display: 'inline-block', display: 'inline-block',
@ -96,15 +97,17 @@ const StatusContent = React.createClass({
const { status } = this.props; const { status } = this.props;
const { hidden } = this.state; const { hidden } = this.state;
const content = { __html: emojify(status.get('content')) }; const content = { __html: emojify(status.get('content')) };
const spoilerContent = { __html: emojify(escapeTextContentForBrowser(status.get('spoiler_text', ''))) }; const spoilerContent = { __html: emojify(escapeTextContentForBrowser(status.get('spoiler_text', ''))) };
if (status.get('spoiler_text').length > 0) { if (status.get('spoiler_text').length > 0) {
const mentionLinks = status.get('mentions').map(item => <Permalink to={`/accounts/${item.get('id')}`} href={item.get('url')} key={item.get('id') className='mention'>@<span>{item.get('username')}</span></Permalink>}</span>) };
const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />; const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />;
return ( return (
<div className='status__content' style={{ cursor: 'pointer' }} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}> <div className='status__content' style={{ cursor: 'pointer' }} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
<p style={{ marginBottom: hidden ? '0px' : '' }} > <p style={{ marginBottom: hidden ? '0px' : '' }} >
{mentionLinks}
<span dangerouslySetInnerHTML={spoilerContent} /> <a className='status__content__spoiler-link' style={spoilerStyle} onClick={this.handleSpoilerClick}>{toggleText}</a> <span dangerouslySetInnerHTML={spoilerContent} /> <a className='status__content__spoiler-link' style={spoilerStyle} onClick={this.handleSpoilerClick}>{toggleText}</a>
</p> </p>

View file

@ -1,3 +1,4 @@
node(:url) { |mention| TagManager.instance.url_for(mention.account) } node(:url) { |mention| TagManager.instance.url_for(mention.account) }
node(:acct) { |mention| mention.account.acct } node(:acct) { |mention| mention.account.acct }
node(:id) { |mention| mention.account_id } node(:id) { |mention| mention.account_id }
node(:username) { |mention| mention.account.username }