From a57196c93f161165b53a176339672d7232abb9d3 Mon Sep 17 00:00:00 2001 From: Doug Lauder Date: Mon, 7 Feb 2022 10:41:07 -0500 Subject: [PATCH] Don't show `Follow` button on card template (#2260) * don't show Follow button on templates * only show Follow button for plugin * force jest into plugin modde --- Makefile | 3 +++ webapp/src/components/cardDialog.test.tsx | 1 + webapp/src/components/cardDialog.tsx | 7 ++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0d29b477b..d96d3553d 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,9 @@ server-test-postgres: ## Run server tests using postgres webapp: ## Build webapp. cd webapp; npm run pack +webapp-test: ## jest tests for webapp + cd webapp; npm run test + watch-plugin: modd-precheck ## Run and upload the plugin to a development server modd -f modd-watchplugin.conf diff --git a/webapp/src/components/cardDialog.test.tsx b/webapp/src/components/cardDialog.test.tsx index 37c263e86..3a74f57aa 100644 --- a/webapp/src/components/cardDialog.test.tsx +++ b/webapp/src/components/cardDialog.test.tsx @@ -23,6 +23,7 @@ jest.mock('draft-js/lib/generateRandomKey', () => () => '123') const mockedUtils = mocked(Utils, true) const mockedMutator = mocked(mutator, true) mockedUtils.createGuid.mockReturnValue('test-id') +mockedUtils.isFocalboardPlugin.mockReturnValue(true) beforeAll(() => { mockDOM() diff --git a/webapp/src/components/cardDialog.tsx b/webapp/src/components/cardDialog.tsx index f023ac106..f7d101000 100644 --- a/webapp/src/components/cardDialog.tsx +++ b/webapp/src/components/cardDialog.tsx @@ -50,6 +50,7 @@ const CardDialog = (props: Props): JSX.Element => { const comments = useAppSelector(getCardComments(props.cardId)) const intl = useIntl() const me = useAppSelector(getMe) + const isTemplate = card && card.fields.isTemplate const [showConfirmationDialogBox, setShowConfirmationDialogBox] = useState(false) const makeTemplateClicked = async () => { @@ -126,7 +127,7 @@ const CardDialog = (props: Props): JSX.Element => { sendFlashMessage({content: intl.formatMessage({id: 'CardDialog.copiedLink', defaultMessage: 'Copied!'}), severity: 'high'}) }} /> - {(card && !card.fields.isTemplate) && + {!isTemplate && { - {card && card.fields.isTemplate && + {isTemplate &&