Merge branch 'master' into fix/12081

This commit is contained in:
DMehaffy 2022-01-13 14:15:50 -08:00 committed by GitHub
commit ba683afcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 38 deletions

View File

@ -70,9 +70,14 @@ const UpgradePlanModal = ({ onClose, isOpen }) => {
return (
<Portal>
<UpgradeWrapper>
<UpgradeWrapper onClick={onClose}>
<FocusTrap onEscape={onClose}>
<UpgradeContainer aria-labelledby="upgrade-plan" background="neutral0" hasRadius>
<UpgradeContainer
onClick={e => e.stopPropagation()}
aria-labelledby="upgrade-plan"
background="neutral0"
hasRadius
>
<img src={AirBalloon} alt="air-balloon" />
<CloseButtonContainer>
<IconButton onClick={onClose} aria-label="Close" icon={<Cross />} />

View File

@ -63,7 +63,7 @@ const EventInput = ({ isDraftAndPublish }) => {
: displayedData.events.default;
const { formatMessage } = useIntl();
const { values, errors, handleChange: onChange } = useFormikContext();
const { values, handleChange: onChange } = useFormikContext();
const inputName = 'events';
const inputValue = values.events;
@ -100,7 +100,7 @@ const EventInput = ({ isDraftAndPublish }) => {
return (
<Stack size={1}>
<FieldLabel required>
<FieldLabel>
{formatMessage({
id: 'Settings.webhooks.form.events',
defaultMessage: 'Events',
@ -154,14 +154,6 @@ const EventInput = ({ isDraftAndPublish }) => {
})}
</tbody>
</StyledTable>
{errors.events && (
<Typography variant="pi" textColor="danger600" data-strapi-field-error>
{formatMessage({
id: 'components.Input.error.validation.required',
defaultMessage: 'This value is required',
})}
</Typography>
)}
</Stack>
);
};

View File

@ -29,10 +29,7 @@ const schema = yup.object().shape({
})
);
}),
events: yup
.array()
.min(1, translatedErrors.min)
.required(translatedErrors.required),
events: yup.array(),
});
export default schema;

View File

@ -330,8 +330,19 @@ const hasCustomAdminCode = async dir => {
return hasCustomConfigFile || hasCustomWebpackFile;
};
/**
* Checks if the project's installed plugins are not the same as a default one.
* @param {Object} plugins
* @returns {boolean}
*/
const hasNonDefaultPlugins = plugins => {
const diff = _.difference(Object.keys(plugins), DEFAULT_PLUGINS);
// List of plugins that are not the ones installed in a generated app
const installedPlugins = Object.keys(plugins).filter(x => !DEFAULT_PLUGINS.includes(x));
// List of default plugins uninstalled from a generated app
const missingPlugins = DEFAULT_PLUGINS.filter(x => !Object.keys(plugins).includes(x));
const diff = [...installedPlugins, ...missingPlugins];
return diff.length > 0;
};

View File

@ -28,16 +28,12 @@ const webhookValidator = yup
)
.required();
}),
events: yup
.array()
.of(
yup
.string()
.oneOf(_.values(webhookUtils.webhookEvents))
.required()
)
.min(1)
.required(),
events: yup.array().of(
yup
.string()
.oneOf(_.values(webhookUtils.webhookEvents))
.required()
),
})
.noUnknown();

View File

@ -8,6 +8,7 @@
const crypto = require('crypto');
const bcrypt = require('bcryptjs');
const urlJoin = require('url-join');
const { getAbsoluteServerUrl, sanitize } = require('@strapi/utils');
const { getService } = require('../utils');
@ -54,14 +55,10 @@ module.exports = ({ strapi }) => ({
params.password = await getService('user').hashPassword(params);
}
return strapi.entityService.update(
'plugin::users-permissions.user',
userId,
{
data: params,
populate: ['role']
}
);
return strapi.entityService.update('plugin::users-permissions.user', userId, {
data: params,
populate: ['role'],
});
},
/**
@ -141,8 +138,9 @@ module.exports = ({ strapi }) => ({
await this.edit(user.id, { confirmationToken });
const apiPrefix = strapi.config.get('api.rest.prefix');
settings.message = await userPermissionService.template(settings.message, {
URL: `${getAbsoluteServerUrl(strapi.config)}/auth/email-confirmation`,
URL: urlJoin(getAbsoluteServerUrl(strapi.config), apiPrefix, '/auth/email-confirmation'),
USER: sanitizedUserInfo,
CODE: confirmationToken,
});

View File

@ -2,6 +2,7 @@
const _ = require('lodash');
const { filter, map, pipe, prop } = require('lodash/fp');
const urlJoin = require('url-join');
const { getService } = require('../utils');
@ -112,9 +113,10 @@ module.exports = ({ strapi }) => ({
return;
}
const apiPrefix = strapi.config.get('api.rest.prefix');
routesMap[`api::${apiName}`] = routes.map(route => ({
...route,
path: `/api${route.path}`,
path: urlJoin(apiPrefix, route.path),
}));
});
@ -133,9 +135,10 @@ module.exports = ({ strapi }) => ({
return;
}
const apiPrefix = strapi.config.get('api.rest.prefix');
routesMap[`plugin::${pluginName}`] = routes.map(route => ({
...route,
path: `/api${route.path}`,
path: urlJoin(apiPrefix, route.path),
}));
});