fix: Hide label actions based on role

This commit is contained in:
Maksim Eltyshev
2022-11-10 15:28:43 +01:00
parent bf8b8474ec
commit 064b37050c
6 changed files with 70 additions and 39 deletions

View File

@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import { BoardMembershipRoles } from '../constants/Enums';
import BoardActions from '../components/BoardActions';
const mapStateToProps = (state) => {
@@ -12,6 +13,7 @@ const mapStateToProps = (state) => {
const labels = selectors.selectLabelsForCurrentBoard(state);
const filterUsers = selectors.selectFilterUsersForCurrentBoard(state);
const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
return {
memberships,
@@ -19,6 +21,7 @@ const mapStateToProps = (state) => {
filterUsers,
filterLabels,
allUsers,
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
canEditMemberships: isCurrentUserManager,
};
};