Port perm checks to the new framework

This commit is contained in:
Chi Vinh Le
2017-06-08 18:28:46 +07:00
parent 9d25a4c14a
commit fb39446c6a
9 changed files with 42 additions and 24 deletions
@@ -30,7 +30,6 @@ export const FakeComment = ({username, created_at, body}) => (
onClick={() => {}}
parentCommentId={'commentID'}
currentUserId={{}}
banned={false}
/>
</div>
<div className="commentActionsRight comment__action-container">
@@ -1,8 +1,8 @@
import React from 'react';
import {Icon} from 'coral-ui';
import styles from './styles.css';
import t from 'coral-framework/services/i18n';
import {withReaction} from 'plugin-api/beta/client/hocs';
import {t, can} from 'plugin-api/beta/client/services';
class LoveButton extends React.Component {
handleClick = () => {
@@ -10,18 +10,18 @@ class LoveButton extends React.Component {
postReaction,
deleteReaction,
showSignInDialog,
alreadyReacted
alreadyReacted,
user,
} = this.props;
const {root: {me}} = this.props;
// If the current user does not exist, trigger sign in dialog.
if (!me) {
if (!user) {
showSignInDialog();
return;
}
// If the current user is banned, do nothing.
if (me.status === 'BANNED') {
// If the current user is suspended, do nothing.
if (!can(user, 'INTERACT_WITH_COMMUNITY')) {
return;
}