Fix error notification bugs

This commit is contained in:
Chi Vinh Le
2017-09-14 22:22:16 +07:00
parent c8cc5e6a34
commit 7600ce8d26
7 changed files with 69 additions and 57 deletions
@@ -1,7 +1,7 @@
import React from 'react';
import styles from './styles.css';
import {withReaction} from 'plugin-api/beta/client/hocs';
import {t, can} from 'plugin-api/beta/client/services';
import {t} from 'plugin-api/beta/client/services';
import {Icon} from 'plugin-api/beta/client/components/ui';
import cn from 'classnames';
@@ -13,7 +13,6 @@ class LikeButton extends React.Component {
postReaction,
deleteReaction,
showSignInDialog,
addNotification,
alreadyReacted,
user,
} = this.props;
@@ -24,12 +23,6 @@ class LikeButton extends React.Component {
return;
}
// If the current user is suspended, do nothing.
if (!can(user, 'INTERACT_WITH_COMMUNITY')) {
addNotification('error', t('error.NOT_AUTHORIZED'));
return;
}
if (alreadyReacted) {
deleteReaction();
} else {
@@ -1,7 +1,7 @@
import React from 'react';
import styles from './styles.css';
import {withReaction} from 'plugin-api/beta/client/hocs';
import {t, can} from 'plugin-api/beta/client/services';
import {t} from 'plugin-api/beta/client/services';
import {Icon} from 'plugin-api/beta/client/components/ui';
import cn from 'classnames';
@@ -13,7 +13,6 @@ class LoveButton extends React.Component {
postReaction,
deleteReaction,
showSignInDialog,
addNotification,
alreadyReacted,
user,
} = this.props;
@@ -24,12 +23,6 @@ class LoveButton extends React.Component {
return;
}
// If the current user is suspended, do nothing.
if (!can(user, 'INTERACT_WITH_COMMUNITY')) {
addNotification('error', t('error.NOT_AUTHORIZED'));
return;
}
if (alreadyReacted) {
deleteReaction();
} else {
@@ -2,7 +2,7 @@ import React from 'react';
import Icon from './Icon';
import styles from './styles.css';
import {withReaction} from 'plugin-api/beta/client/hocs';
import {t, can} from 'plugin-api/beta/client/services';
import {t} from 'plugin-api/beta/client/services';
import cn from 'classnames';
const plugin = 'talk-plugin-respect';
@@ -14,7 +14,6 @@ class RespectButton extends React.Component {
deleteReaction,
showSignInDialog,
alreadyReacted,
addNotification,
user,
} = this.props;
@@ -24,12 +23,6 @@ class RespectButton extends React.Component {
return;
}
// If the current user is suspended, do nothing.
if (!can(user, 'INTERACT_WITH_COMMUNITY')) {
addNotification('error', t('error.NOT_AUTHORIZED'));
return;
}
if (alreadyReacted) {
deleteReaction();
} else {