2017-09-21 06:51:45 +09:00
|
|
|
// `<NotificationFollow>`
|
|
|
|
// ======================
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// * * * * * * * //
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Imports
|
|
|
|
// -------
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Package imports.
|
2017-07-15 03:13:02 +09:00
|
|
|
import React from 'react';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-07-22 03:33:16 +09:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2017-07-15 03:13:02 +09:00
|
|
|
import escapeTextContentForBrowser from 'escape-html';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Mastodon imports.
|
2017-07-15 03:13:02 +09:00
|
|
|
import emojify from '../../../mastodon/emoji';
|
|
|
|
import Permalink from '../../../mastodon/components/permalink';
|
|
|
|
import AccountContainer from '../../../mastodon/containers/account_container';
|
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Our imports.
|
2017-07-22 03:33:16 +09:00
|
|
|
import NotificationOverlayContainer from '../notification/overlay/container';
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// * * * * * * * //
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Implementation
|
|
|
|
// --------------
|
2017-07-15 03:13:02 +09:00
|
|
|
|
|
|
|
export default class NotificationFollow extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
2017-09-28 17:04:20 +09:00
|
|
|
id : PropTypes.string.isRequired,
|
2017-07-15 03:13:02 +09:00
|
|
|
account : ImmutablePropTypes.map.isRequired,
|
2017-07-22 03:33:16 +09:00
|
|
|
notification : ImmutablePropTypes.map.isRequired,
|
2017-07-15 03:13:02 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2017-07-22 03:33:16 +09:00
|
|
|
const { account, notification } = this.props;
|
2017-07-15 03:13:02 +09:00
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Links to the display name.
|
2017-07-15 03:13:02 +09:00
|
|
|
const displayName = account.get('display_name') || account.get('username');
|
|
|
|
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
|
|
|
|
const link = (
|
|
|
|
<Permalink
|
|
|
|
className='notification__display-name'
|
|
|
|
href={account.get('url')}
|
|
|
|
title={account.get('acct')}
|
|
|
|
to={`/accounts/${account.get('id')}`}
|
|
|
|
dangerouslySetInnerHTML={displayNameHTML}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
2017-09-21 06:51:45 +09:00
|
|
|
// Renders.
|
2017-07-15 03:13:02 +09:00
|
|
|
return (
|
|
|
|
<div className='notification notification-follow'>
|
|
|
|
<div className='notification__message'>
|
|
|
|
<div className='notification__favourite-icon-wrapper'>
|
|
|
|
<i className='fa fa-fw fa-user-plus' />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
id='notification.follow'
|
|
|
|
defaultMessage='{name} followed you'
|
|
|
|
values={{ name: link }}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<AccountContainer id={account.get('id')} withNote={false} />
|
2017-07-22 04:12:43 +09:00
|
|
|
<NotificationOverlayContainer notification={notification} />
|
2017-07-15 03:13:02 +09:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|