-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom Content Types: Ensure settings page functionality works withou…
…t module requirement (#41349)
- Loading branch information
1 parent
fdcb681
commit b1341be
Showing
20 changed files
with
358 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
projects/js-packages/api/changelog/remove-custom-content-type-module-requirement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Custom Content Types: Ensure feature works on Jetpack settings page without using module functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...cts/packages/classic-theme-helper/changelog/remove-custom-content-type-module-requirement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Custom Content Types: Ensure feature works on Jetpack settings page without using module functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
projects/plugins/jetpack/_inc/client/state/feature-check/actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import restApi from '@automattic/jetpack-api'; | ||
import { | ||
CUSTOM_FEATURE_ACTIVE_FETCH_FAIL, | ||
CUSTOM_FEATURE_ACTIVE_FETCH_SUCCESS, | ||
CUSTOM_FEATURE_ACTIVE_FETCH, | ||
} from 'state/action-types'; | ||
|
||
/** | ||
* Fetch the status of the custom content types feature. | ||
* | ||
* @param {string} featureType - The custom content type to check. | ||
* @return {Function} The action. | ||
*/ | ||
export const getActiveFeatureDetails = featureType => { | ||
return dispatch => { | ||
dispatch( { | ||
type: CUSTOM_FEATURE_ACTIVE_FETCH, | ||
} ); | ||
return restApi | ||
.getFeatureTypeStatus( featureType ) | ||
.then( data => { | ||
dispatch( { | ||
type: CUSTOM_FEATURE_ACTIVE_FETCH_SUCCESS, | ||
feature_data: data, | ||
} ); | ||
return data; | ||
} ) | ||
.catch( error => { | ||
dispatch( { | ||
type: CUSTOM_FEATURE_ACTIVE_FETCH_FAIL, | ||
error: error, | ||
} ); | ||
} ); | ||
}; | ||
}; |
2 changes: 2 additions & 0 deletions
2
projects/plugins/jetpack/_inc/client/state/feature-check/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './reducer'; | ||
export * from './actions'; |
30 changes: 30 additions & 0 deletions
30
projects/plugins/jetpack/_inc/client/state/feature-check/reducer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { assign } from 'lodash'; | ||
import { combineReducers } from 'redux'; | ||
import { | ||
CUSTOM_FEATURE_ACTIVE_FETCH_FAIL, | ||
CUSTOM_FEATURE_ACTIVE_FETCH_SUCCESS, | ||
CUSTOM_FEATURE_ACTIVE_FETCH, | ||
} from 'state/action-types'; | ||
|
||
export const items = ( state = { fetchingCustomContentTypeStatus: false }, action ) => { | ||
switch ( action.type ) { | ||
case CUSTOM_FEATURE_ACTIVE_FETCH: | ||
return assign( {}, state, { fetchingCustomContentTypeStatus: true } ); | ||
case CUSTOM_FEATURE_ACTIVE_FETCH_SUCCESS: | ||
return { | ||
...state, | ||
featureData: { | ||
...state.featureCheck, | ||
...action.feature_data, | ||
}, | ||
}; | ||
case CUSTOM_FEATURE_ACTIVE_FETCH_FAIL: | ||
return { ...state, fetchingCustomContentTypeStatus: false, error: action.error }; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export const reducer = combineReducers( { | ||
items, | ||
} ); |
Oops, something went wrong.