Merge branch 'master' into comment-history-blank

This commit is contained in:
Kim Gardner
2018-03-08 14:33:43 -05:00
committed by GitHub
4 changed files with 43 additions and 22 deletions
@@ -20,3 +20,7 @@
color: #D0011B;
text-decoration: underline;
}
.blank {
color: #7d8285;
}
@@ -1,23 +1,38 @@
import React from 'react';
import PropTypes from 'prop-types';
import styles from './IgnoredUserSection.css';
import { t } from 'plugin-api/beta/client/services';
export default ({ ignoredUsers, stopIgnoringUser }) => (
const IgnoreUserSection = ({ ignoredUsers, stopIgnoringUser }) => (
<section className={'talk-plugin-ignore-user-section'}>
<h3>{t('talk-plugin-ignore-user.section_title')}</h3>
<p>{t('talk-plugin-ignore-user.section_info')}</p>
<ul className={styles.list}>
{ignoredUsers.map(({ username, id }) => (
<li className={styles.listItem} key={id}>
<span className={styles.username}>{username}</span>
<button
onClick={() => stopIgnoringUser({ id })}
className={styles.button}
>
{t('talk-plugin-ignore-user.stop_ignoring')}
</button>
</li>
))}
</ul>
{!ignoredUsers.length && (
<p className={styles.blank}>{t('talk-plugin-ignore-user.blank_info')}</p>
)}
{!!ignoredUsers.length && (
<div>
<p>{t('talk-plugin-ignore-user.section_info')}</p>
<ul className={styles.list}>
{ignoredUsers.map(({ username, id }) => (
<li className={styles.listItem} key={id}>
<span className={styles.username}>{username}</span>
<button
onClick={() => stopIgnoringUser({ id })}
className={styles.button}
>
{t('talk-plugin-ignore-user.stop_ignoring')}
</button>
</li>
))}
</ul>
</div>
)}
</section>
);
IgnoreUserSection.propTypes = {
ignoredUsers: PropTypes.array.isRequired,
stopIgnoringUser: PropTypes.func.isRequired,
};
export default IgnoreUserSection;
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import IgnoredUserSection from '../components/IgnoredUserSection';
import { compose, gql } from 'react-apollo';
import {
withFragments,
excludeIf,
withStopIgnoringUser,
} from 'plugin-api/beta/client/hocs';
@@ -18,6 +18,11 @@ class IgnoredUserSectionContainer extends React.Component {
}
}
IgnoredUserSectionContainer.propTypes = {
stopIgnoringUser: PropTypes.func.isRequired,
root: PropTypes.object.isRequired,
};
const withIgnoredUserSectionFragments = withFragments({
root: gql`
fragment TalkIgnoreUser_IgnoredUserSection_root on RootQuery {
@@ -32,10 +37,6 @@ const withIgnoredUserSectionFragments = withFragments({
`,
});
const enhance = compose(
withIgnoredUserSectionFragments,
withStopIgnoringUser,
excludeIf(({ root: { me } }) => me.ignoredUsers.length === 0)
);
const enhance = compose(withIgnoredUserSectionFragments, withStopIgnoringUser);
export default enhance(IgnoredUserSectionContainer);
@@ -13,6 +13,7 @@ da:
confirmation_title: Ignore {0}?
en:
talk-plugin-ignore-user:
blank_info: You are currently not ignoring any users
section_title: Ignored users
section_info: Because you ignored the following commenters, their comments are hidden.
stop_ignoring: Stop ignoring
@@ -68,7 +69,7 @@ nl_NL:
ignore_user: Gebruiker negeren
cancel: Annuleren
confirmation: |
Wanneer je een gebruiker negeert, zullen al zijn/haar reacties voor jou worden verborgen. Je kunt
Wanneer je een gebruiker negeert, zullen al zijn/haar reacties voor jou worden verborgen. Je kunt
dit later ongedaan maken vanuit Mijn profiel.
notify_success: |
Je negeert nu {0}. Je kunt dit ongedaan maken vanuit Mijn profiel.