1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-27 08:31:20 +02:00

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
This commit is contained in:
Doug Lauder 2022-02-07 10:41:07 -05:00 committed by GitHub
parent 870c56e6b3
commit a57196c93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -137,6 +137,9 @@ server-test-postgres: ## Run server tests using postgres
webapp: ## Build webapp. webapp: ## Build webapp.
cd webapp; npm run pack 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 watch-plugin: modd-precheck ## Run and upload the plugin to a development server
modd -f modd-watchplugin.conf modd -f modd-watchplugin.conf

View File

@ -23,6 +23,7 @@ jest.mock('draft-js/lib/generateRandomKey', () => () => '123')
const mockedUtils = mocked(Utils, true) const mockedUtils = mocked(Utils, true)
const mockedMutator = mocked(mutator, true) const mockedMutator = mocked(mutator, true)
mockedUtils.createGuid.mockReturnValue('test-id') mockedUtils.createGuid.mockReturnValue('test-id')
mockedUtils.isFocalboardPlugin.mockReturnValue(true)
beforeAll(() => { beforeAll(() => {
mockDOM() mockDOM()

View File

@ -50,6 +50,7 @@ const CardDialog = (props: Props): JSX.Element => {
const comments = useAppSelector(getCardComments(props.cardId)) const comments = useAppSelector(getCardComments(props.cardId))
const intl = useIntl() const intl = useIntl()
const me = useAppSelector<IUser|null>(getMe) const me = useAppSelector<IUser|null>(getMe)
const isTemplate = card && card.fields.isTemplate
const [showConfirmationDialogBox, setShowConfirmationDialogBox] = useState<boolean>(false) const [showConfirmationDialogBox, setShowConfirmationDialogBox] = useState<boolean>(false)
const makeTemplateClicked = async () => { const makeTemplateClicked = async () => {
@ -126,7 +127,7 @@ const CardDialog = (props: Props): JSX.Element => {
sendFlashMessage({content: intl.formatMessage({id: 'CardDialog.copiedLink', defaultMessage: 'Copied!'}), severity: 'high'}) sendFlashMessage({content: intl.formatMessage({id: 'CardDialog.copiedLink', defaultMessage: 'Copied!'}), severity: 'high'})
}} }}
/> />
{(card && !card.fields.isTemplate) && {!isTemplate &&
<Menu.Text <Menu.Text
id='makeTemplate' id='makeTemplate'
name='New template from card' name='New template from card'
@ -167,9 +168,9 @@ const CardDialog = (props: Props): JSX.Element => {
<Dialog <Dialog
onClose={props.onClose} onClose={props.onClose}
toolsMenu={!props.readonly && menu} toolsMenu={!props.readonly && menu}
toolbar={toolbar} toolbar={!isTemplate && Utils.isFocalboardPlugin() && toolbar}
> >
{card && card.fields.isTemplate && {isTemplate &&
<div className='banner'> <div className='banner'>
<FormattedMessage <FormattedMessage
id='CardDialog.editing-template' id='CardDialog.editing-template'