mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 08:04:51 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
70628ce082
@ -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 />} />
|
||||
|
||||
@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -108,8 +108,14 @@ module.exports = ({ action, ability, model }) => {
|
||||
const omitCreatorRoles = omit([`${CREATED_BY_ATTRIBUTE}.roles`, `${UPDATED_BY_ATTRIBUTE}.roles`]);
|
||||
|
||||
const pickAllowedAdminUserFields = ({ attribute, key, value }, { set }) => {
|
||||
if (attribute.type === 'relation' && attribute.target === 'admin::user') {
|
||||
set(key, pick(['id', 'firstname', 'lastname', 'username'], value));
|
||||
const pickAllowedFields = pick(['id', 'firstname', 'lastname', 'username']);
|
||||
|
||||
if (attribute.type === 'relation' && attribute.target === 'admin::user' && value) {
|
||||
if (Array.isArray(value)) {
|
||||
set(key, value.map(pickAllowedFields));
|
||||
} else {
|
||||
set(key, pickAllowedFields(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -55,17 +55,6 @@ const applyUserExtension = async plugins => {
|
||||
}
|
||||
};
|
||||
|
||||
const formatContentTypes = plugins => {
|
||||
for (const pluginName in plugins) {
|
||||
const plugin = plugins[pluginName];
|
||||
for (const contentTypeName in plugin.contentTypes) {
|
||||
const ctSchema = plugin.contentTypes[contentTypeName].schema;
|
||||
ctSchema.plugin = pluginName;
|
||||
ctSchema.uid = `plugin::${pluginName}.${ctSchema.singularName}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const applyUserConfig = async plugins => {
|
||||
const userPluginsConfig = await getUserPluginsConfig();
|
||||
|
||||
@ -111,7 +100,6 @@ const loadPlugins = async strapi => {
|
||||
// TODO: validate plugin format
|
||||
await applyUserConfig(plugins);
|
||||
await applyUserExtension(plugins);
|
||||
formatContentTypes(plugins);
|
||||
|
||||
for (const pluginName in plugins) {
|
||||
strapi.container.get('plugins').add(pluginName, plugins[pluginName]);
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -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),
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user