Skip to content
Snippets Groups Projects
Unverified Commit 80362ba3 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix saving collection without description. Show warning when All Users has...

Fix saving collection without description. Show warning when All Users has access to a collection another group doesn't
parent b22158b5
No related branches found
No related tags found
No related merge requests found
......@@ -419,6 +419,8 @@ export const getDatabasesPermissionsGrid = createSelector(
);
const getCollections = (state) => state.permissions.collections;
const getCollectionPermission = (permissions, groupId, { collectionId }) =>
getIn(permissions, [groupId, collectionId])
export const getCollectionsPermissionsGrid = createSelector(
getCollections, getGroups, getPermissions,
......@@ -427,6 +429,8 @@ export const getCollectionsPermissionsGrid = createSelector(
return null;
}
const defaultGroup = _.find(groups, isDefaultGroup);
return {
type: "collection",
groups,
......@@ -435,16 +439,19 @@ export const getCollectionsPermissionsGrid = createSelector(
options(groupId, entityId) {
return [OPTION_COLLECTION_WRITE, OPTION_COLLECTION_READ, OPTION_NONE];
},
getter(groupId, { collectionId }) {
return getIn(permissions, [groupId, collectionId]);
getter(groupId, entityId) {
return getCollectionPermission(permissions, groupId, entityId);
},
updater(groupId, { collectionId }, value) {
return assocIn(permissions, [groupId, collectionId], value);
},
confirm(groupId, entityId, value) {
return [];
return [
getPermissionWarningModal(getCollectionPermission, null, defaultGroup, permissions, groupId, entityId, value)
];
},
warning(groupId, entityId) {
return getPermissionWarning(getCollectionPermission, null, defaultGroup, permissions, groupId, entityId);
}
},
},
......
......@@ -21,6 +21,10 @@ export const loadCollections = createAction(LOAD_COLLECTIONS, CollectionsApi.lis
export const saveCollection = createThunkAction(SAVE_COLLECTION, (collection) => {
return async (dispatch, getState) => {
try {
if (!collection.description) {
// description must be nil or non empty string
collection = { ...collection, description: null }
}
let response;
if (collection.id == null) {
MetabaseAnalytics.trackEvent("Collections", "Create");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment