Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Updated logic for funds links #3617

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ const ColonyFundingMenu = ({
const mustUpgradeOneTx = oneTxMustBeUpgraded(oneTxPaymentExtension);

const canEdit =
userHasRole(rootRoles, ColonyRole.Root) ||
userHasRole(rootRoles, ColonyRole.Administration);
const canMoveTokens = userHasRole(rootRoles, ColonyRole.Funding);
isVotingExtensionEnabled || userHasRole(rootRoles, ColonyRole.Root);
const canMoveTokens =
isVotingExtensionEnabled || userHasRole(rootRoles, ColonyRole.Funding);
const canUserMintNativeToken = isVotingExtensionEnabled
? colony.canColonyMintNativeToken
: userHasRole(rootRoles, ColonyRole.Root) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ import { SpinnerLoader } from '~core/Preloaders';
import Heading from '~core/Heading';
import InfoPopover from '~core/InfoPopover';
import NavLink from '~core/NavLink';
import {
useLoggedInUser,
Colony,
useTokenBalancesForDomainsQuery,
} from '~data/index';
import { useTransformer } from '~utils/hooks';
import { canFund } from '~modules/users/checks';
import { getAllUserRoles } from '~modules/transformers';
import { Colony, useTokenBalancesForDomainsQuery } from '~data/index';

import TokenItem from './TokenItem';

Expand All @@ -33,12 +26,6 @@ interface Props {
const displayName = 'dashboard.ColonyHome.ColonyFunding';

const ColonyFunding = ({ colony, currentDomainId }: Props) => {
const { walletAddress, ethereal, username } = useLoggedInUser();

const allUserRoles = useTransformer(getAllUserRoles, [colony, walletAddress]);

const canMoveFunds = !!username && !ethereal && canFund(allUserRoles);

const {
colonyAddress,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 60 below canMoveFunds ? ... is the logic that needs to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Thanks Will.

tokens: colonyTokens,
Expand All @@ -62,13 +49,9 @@ const ColonyFunding = ({ colony, currentDomainId }: Props) => {
return (
<div className={styles.main}>
<Heading appearance={{ size: 'normal', weight: 'bold' }}>
{canMoveFunds ? (
<NavLink to={`/colony/${colonyName}/funds`}>
<FormattedMessage {...MSG.title} />
</NavLink>
) : (
<NavLink to={`/colony/${colonyName}/funds`}>
<FormattedMessage {...MSG.title} />
)}
</NavLink>
</Heading>
{data && !isLoadingTokenBalances ? (
<ul data-test="availableFunds">
Expand Down