remove wrong emojify usage in old glitch components

master
Ondřej Hruška 7 years ago
parent 74e4fc8f8a
commit cf24ce7e03
No known key found for this signature in database
GPG Key ID: 2C5FD5035250423D
  1. 14
      app/javascript/glitch/components/account/header.js
  2. 7
      app/javascript/glitch/components/notification/follow.js
  3. 8
      app/javascript/glitch/components/status/content.js
  4. 8
      app/javascript/glitch/components/status/prepend.js

@ -44,7 +44,6 @@ Imports:
import React from 'react'; import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import escapeTextContentForBrowser from 'escape-html';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
@ -89,7 +88,7 @@ export default class AccountHeader extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account : ImmutablePropTypes.map, account : ImmutablePropTypes.map,
me : PropTypes.number.isRequired, me : PropTypes.string.isRequired,
onFollow : PropTypes.func.isRequired, onFollow : PropTypes.func.isRequired,
intl : PropTypes.object.isRequired, intl : PropTypes.object.isRequired,
}; };
@ -117,7 +116,7 @@ then we set the `displayName` to just be the `username` of the account.
return null; return null;
} }
let displayName = account.get('display_name'); let displayName = account.get('display_name_html');
let info = ''; let info = '';
let actionBtn = ''; let actionBtn = '';
let following = false; let following = false;
@ -167,16 +166,11 @@ appropriate icon.
} }
/* /*
we extract the `text` and
`displayNameHTML` processes the `displayName` and prepares it for
insertion into the document. Meanwhile, we extract the `text` and
`metadata` from our account's `note` using `processBio()`. `metadata` from our account's `note` using `processBio()`.
*/ */
const displayNameHTML = {
__html : emojify(escapeTextContentForBrowser(displayName)),
};
const { text, metadata } = processBio(account.get('note')); const { text, metadata } = processBio(account.get('note'));
/* /*
@ -198,7 +192,7 @@ Here, we render our component using all the things we've defined above.
</span> </span>
<span <span
className='account__header__display-name' className='account__header__display-name'
dangerouslySetInnerHTML={displayNameHTML} dangerouslySetInnerHTML={{ __html: displayName }}
/> />
</a> </a>
<span className='account__header__username'> <span className='account__header__username'>

@ -11,11 +11,9 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import escapeTextContentForBrowser from 'escape-html';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
// Mastodon imports. // Mastodon imports.
import emojify from '../../../mastodon/emoji';
import Permalink from '../../../mastodon/components/permalink'; import Permalink from '../../../mastodon/components/permalink';
import AccountContainer from '../../../mastodon/containers/account_container'; import AccountContainer from '../../../mastodon/containers/account_container';
@ -39,15 +37,14 @@ export default class NotificationFollow extends ImmutablePureComponent {
const { account, notification } = this.props; const { account, notification } = this.props;
// Links to the display name. // Links to the display name.
const displayName = account.get('display_name') || account.get('username'); const displayName = account.get('display_name_html') || account.get('username');
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
const link = ( const link = (
<Permalink <Permalink
className='notification__display-name' className='notification__display-name'
href={account.get('url')} href={account.get('url')}
title={account.get('acct')} title={account.get('acct')}
to={`/accounts/${account.get('id')}`} to={`/accounts/${account.get('id')}`}
dangerouslySetInnerHTML={displayNameHTML} dangerouslySetInnerHTML={{ __html: displayName }}
/> />
); );

@ -1,13 +1,11 @@
// Package imports // // Package imports //
import React from 'react'; import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import escapeTextContentForBrowser from 'escape-html';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import classnames from 'classnames'; import classnames from 'classnames';
// Mastodon imports // // Mastodon imports //
import emojify from '../../../mastodon/emoji';
import { isRtl } from '../../../mastodon/rtl'; import { isRtl } from '../../../mastodon/rtl';
import Permalink from '../../../mastodon/components/permalink'; import Permalink from '../../../mastodon/components/permalink';
@ -32,7 +30,7 @@ export default class StatusContent extends React.PureComponent {
const node = this.node; const node = this.node;
const links = node.querySelectorAll('a'); const links = node.querySelectorAll('a');
for (var i = 0; i < links.length; ++i) { for (let i = 0; i < links.length; ++i) {
let link = links[i]; let link = links[i];
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url')); let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
@ -132,9 +130,7 @@ export default class StatusContent extends React.PureComponent {
); );
const content = { __html: status.get('contentHtml') }; const content = { __html: status.get('contentHtml') };
const spoilerContent = { const spoilerContent = { __html: status.get('spoilerHtml') };
__html: status.get('spoilerHtml'),
};
const directionStyle = { direction: 'ltr' }; const directionStyle = { direction: 'ltr' };
const classNames = classnames('status__content', { const classNames = classnames('status__content', {
'status__content--with-action': parseClick && !disabled, 'status__content--with-action': parseClick && !disabled,

@ -22,12 +22,8 @@ Imports:
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import escapeTextContentForBrowser from 'escape-html';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
// Mastodon imports //
import emojify from '../../../mastodon/emoji';
/* * * * */ /* * * * */
/* /*
@ -99,9 +95,7 @@ generate the message.
> >
<b <b
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html : emojify(escapeTextContentForBrowser( __html : account.get('display_name_html') || account.get('username'),
account.get('display_name') || account.get('username')
)),
}} }}
/> />
</a> </a>

Loading…
Cancel
Save