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: description in release step #3726

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 @@ -34,15 +34,12 @@ const FinalizePaymentModal: FC<FinalizePaymentModalProps> = ({
isOpen,
onClose,
onSuccess,
actionType,
...rest
}) => {
const { colony } = useColonyContext();
const { user } = useAppContext();
const finalizeDecisionMethodItems = useGetFinalizeDecisionMethodItems(
expenditure,
actionType,
);
const finalizeDecisionMethodItems =
useGetFinalizeDecisionMethodItems(expenditure);

const noDecisionMethodAvailable = finalizeDecisionMethodItems.every(
({ isDisabled }) => isDisabled,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { type Action } from '~constants/actions.ts';
import { useAppContext } from '~context/AppContext/AppContext.ts';
import useEnabledExtensions from '~hooks/useEnabledExtensions.ts';
import { DecisionMethod } from '~types/actions.ts';
import { type Expenditure } from '~types/graphql.ts';
import { formatText } from '~utils/intl.ts';
import { useCheckIfUserHasPermissions } from '~v5/common/CompletedAction/partials/PaymentBuilder/hooks.ts';

import { type DecisionMethodOption } from '../DecisionMethodSelect/types.ts';

export const useGetFinalizeDecisionMethodItems = (
expenditure: Expenditure,
actionType: Action,
): DecisionMethodOption[] => {
const { user } = useAppContext();
const isPermissionsEnabled = useCheckIfUserHasPermissions(actionType);
const { isVotingReputationEnabled } = useEnabledExtensions();

const userIsCreator = user?.walletAddress === expenditure.ownerAddress;
Expand All @@ -23,15 +19,6 @@ export const useGetFinalizeDecisionMethodItems = (
}

return [
...(isPermissionsEnabled || (!isPermissionsEnabled && !userIsCreator)
? [
{
label: formatText({ id: 'decisionMethod.permissions' }),
value: DecisionMethod.Permissions,
isDisabled: !isPermissionsEnabled,
},
]
: []),
...(isVotingReputationEnabled
? [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ export const useGetFinalizeStep = ({
)}

{selectedFinalizeAction && !selectedFinalizeMotion && (
<ActionWithPermissionsInfo action={selectedFinalizeAction} />
<FinalizeByPaymentCreatorInfo
userAdddress={selectedFinalizeAction.initiatorAddress}
/>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we should perform a similar check for userIsCreator to decide which description to actually show


{expenditureStep === ExpenditureStep.Release &&
Expand Down
Loading