From d15b71a057ca978447055690f511d2dd243961fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Hodierne?= Date: Tue, 11 Aug 2026 14:08:59 +0200 Subject: [PATCH] Hide internal platform tip kinds from profile transactions by default APPLICATION_FEE is removed from the default kinds: it only ever appears on host-side accounts as the internal fee leg moving collected tips to the platform. PLATFORM_TIP is now excluded from the defaults on fiscal host profiles only, where the rows are tips collected on the internal Platform Tips child account rather than host activity. Contributors (individuals and organizations) still see the tips they gave. Both kinds remain available through the kind filter on the transactions page. Dashboard views and exports are unchanged. --- components/collective-page/graphql/preload.js | 4 ++-- components/collective-page/sections/Budget.js | 6 +++--- .../collective-page/sections/Transactions.js | 11 ++++++++--- .../sections/collectives/AddFundsModal.tsx | 2 +- .../filters/TransactionsKindFilter.js | 16 +++++++++++----- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/components/collective-page/graphql/preload.js b/components/collective-page/graphql/preload.js index 7237e762c54..1a199173c55 100644 --- a/components/collective-page/graphql/preload.js +++ b/components/collective-page/graphql/preload.js @@ -40,7 +40,7 @@ export const preloadCollectivePageGraphqlQueries = async (client, collective) => queries.push( client.query({ query: getBudgetSectionQuery(Boolean(collective.host), isIndividual), - variables: getBudgetSectionQueryVariables(slug, isIndividual, collective.host), + variables: getBudgetSectionQueryVariables(slug, isIndividual, collective.host, collective.isHost), }), ); } @@ -50,7 +50,7 @@ export const preloadCollectivePageGraphqlQueries = async (client, collective) => queries.push( client.query({ query: transactionsSectionQuery, - variables: getTransactionsSectionQueryVariables(slug), + variables: getTransactionsSectionQueryVariables(slug, collective.isHost), }), ); } diff --git a/components/collective-page/sections/Budget.js b/components/collective-page/sections/Budget.js index 1349c3b4632..a18b08531a6 100644 --- a/components/collective-page/sections/Budget.js +++ b/components/collective-page/sections/Budget.js @@ -227,7 +227,7 @@ export const getBudgetSectionQuery = (hasHost, isIndividual) => { } }; -export const getBudgetSectionQueryVariables = (collectiveSlug, isIndividual, host) => { +export const getBudgetSectionQueryVariables = (collectiveSlug, isIndividual, host, isHost) => { if (isIndividual) { return { slug: collectiveSlug, limit: 3, kind: getDefaultKinds().filter(kind => kind !== TransactionKind.EXPENSE) }; } else { @@ -235,7 +235,7 @@ export const getBudgetSectionQueryVariables = (collectiveSlug, isIndividual, hos slug: collectiveSlug, host: host ? { slug: host.slug } : null, limit: 3, - kind: getDefaultKinds(), + kind: getDefaultKinds({ isHost: Boolean(isHost) }), heavyAccount: isHeavyAccount(collectiveSlug), }; } @@ -333,7 +333,7 @@ const SectionBudget = ({ collective, LoggedInUser }) => { const [filter, setFilter] = React.useState('all'); const isIndividual = isIndividualAccount(collective) && !collective.isHost; const budgetQueryResult = useQuery(getBudgetSectionQuery(Boolean(collective.host), isIndividual), { - variables: getBudgetSectionQueryVariables(collective.slug, isIndividual, collective.host), + variables: getBudgetSectionQueryVariables(collective.slug, isIndividual, collective.host, collective.isHost), }); const { data, refetch } = budgetQueryResult; diff --git a/components/collective-page/sections/Transactions.js b/components/collective-page/sections/Transactions.js index 932b41be9f9..59850c8b909 100644 --- a/components/collective-page/sections/Transactions.js +++ b/components/collective-page/sections/Transactions.js @@ -63,13 +63,18 @@ export const transactionsSectionQuery = gql` ${transactionsQueryCollectionFragment} `; -export const getTransactionsSectionQueryVariables = slug => { - return { slug, limit: NB_DISPLAYED, kind: getDefaultKinds(), includeGiftCardTransactions: !isHeavyAccount(slug) }; +export const getTransactionsSectionQueryVariables = (slug, isHost) => { + return { + slug, + limit: NB_DISPLAYED, + kind: getDefaultKinds({ isHost: Boolean(isHost) }), + includeGiftCardTransactions: !isHeavyAccount(slug), + }; }; const SectionTransactions = props => { const transactionsQueryResult = useQuery(transactionsSectionQuery, { - variables: getTransactionsSectionQueryVariables(props.collective.slug), + variables: getTransactionsSectionQueryVariables(props.collective.slug, props.collective.isHost), // We keep notifyOnNetworkStatusChange to remove the flash of collectiveHasNoTransactions bug // See https://github.com/apollographql/apollo-client/blob/9c80adf65ccbbb88ea5b9313c002f85976c225e3/src/core/ObservableQuery.ts#L274-L304 diff --git a/components/dashboard/sections/collectives/AddFundsModal.tsx b/components/dashboard/sections/collectives/AddFundsModal.tsx index 1a15fe22be7..bffae679b08 100644 --- a/components/dashboard/sections/collectives/AddFundsModal.tsx +++ b/components/dashboard/sections/collectives/AddFundsModal.tsx @@ -515,7 +515,7 @@ const AddFundsModalContentWithCollective = ({ refetchQueries: [ { query: getBudgetSectionQuery(true, false), - variables: getBudgetSectionQueryVariables(collective.slug, false, host), + variables: getBudgetSectionQueryVariables(collective.slug, false, host, account?.isHost), }, { query: collectivePageQuery, diff --git a/components/transactions/filters/TransactionsKindFilter.js b/components/transactions/filters/TransactionsKindFilter.js index f9ab7700cf4..8e7d02fbba0 100644 --- a/components/transactions/filters/TransactionsKindFilter.js +++ b/components/transactions/filters/TransactionsKindFilter.js @@ -1,13 +1,19 @@ import { TransactionKind } from '../../../lib/constants/transactions'; -// (!) Remember that any changes made here should be applied to the cache in API > `getCacheKeyForBudgetOrTransactionsSections` -export const getDefaultKinds = () => { - return [ +export const getDefaultKinds = ({ isHost = false } = {}) => { + const kinds = [ TransactionKind.ADDED_FUNDS, TransactionKind.BALANCE_TRANSFER, TransactionKind.CONTRIBUTION, TransactionKind.EXPENSE, - TransactionKind.PLATFORM_TIP, - TransactionKind.APPLICATION_FEE, ]; + + // On a Fiscal Host profile, PLATFORM_TIP transactions are the tips collected on the internal + // "Platform Tips" child account (money owed to the platform, not host activity). For other + // accounts they are tips the account gave, which are part of its own financial activity. + if (!isHost) { + kinds.push(TransactionKind.PLATFORM_TIP); + } + + return kinds; };