kgabryje commented on code in PR #20448:
URL: https://github.com/apache/superset/pull/20448#discussion_r903747663
##########
superset-frontend/src/explore/reducers/getInitialState.ts:
##########
@@ -52,40 +61,49 @@ export interface ExplorePageBootstrapData extends
JsonObject {
export default function getInitialState(
bootstrapData: ExplorePageBootstrapData,
) {
- const { form_data: initialFormData } = bootstrapData;
- const { slice } = bootstrapData;
- const sliceName = slice ? slice.slice_name : null;
+ const {
+ form_data: initialFormData,
+ common,
+ user,
+ datasource,
+ slice,
+ } = bootstrapData;
const exploreState = {
// note this will add `form_data` to state,
// which will be manipulatable by future reducers.
- ...bootstrapData,
- sliceName,
- common: {
- flash_messages: bootstrapData.common.flash_messages,
- conf: bootstrapData.common.conf,
- },
+ can_add: findPermission('can_write', 'Chart', user?.roles),
+ can_download: findPermission('can_csv', 'Superset', user?.roles),
+ can_overwrite: ensureIsArray(slice?.owners).includes(
+ user?.userId as number,
Review Comment:
If value is `null` or `undefined`, `ensureIsArray` returns an empty array.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]