-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…41461) * Revert changes to settings endpoint * Update the param name in social endpoint * Pass the API path based on active plugin * Make the front-end changes to use the dynamic endpoint for settings * Ensure to return module state from Jetpack endpoint * Add changelog * Fix unit tests
- Loading branch information
1 parent
4b2a4a9
commit 6d654b3
Showing
22 changed files
with
182 additions
and
233 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...js-packages/publicize-components/changelog/update-social-to-use-unified-settings-endpoint
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: patch | ||
Type: changed | ||
|
||
Update the settings endppoint to use existing endpoints |
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
20 changes: 20 additions & 0 deletions
20
projects/js-packages/publicize-components/src/social-store/actions/social-module-settings.ts
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,20 @@ | ||
import { store as coreStore } from '@wordpress/core-data'; | ||
import { getSocialScriptData } from '../../utils'; | ||
import { SocialModuleSettings } from '../types'; | ||
|
||
/** | ||
* Saves the Social module settings. | ||
* | ||
* @param data - The data to save. | ||
* | ||
* @return A thunk. | ||
*/ | ||
export function updateSocialModuleSettings( data: Partial< SocialModuleSettings > ) { | ||
return async function ( { registry } ) { | ||
const { socialToggleBase } = getSocialScriptData().api_paths; | ||
|
||
const { saveEntityRecord } = registry.dispatch( coreStore ); | ||
|
||
await saveEntityRecord( 'jetpack/v4', socialToggleBase, data ); | ||
}; | ||
} |
17 changes: 0 additions & 17 deletions
17
projects/js-packages/publicize-components/src/social-store/actions/social-plugin-settings.ts
This file was deleted.
Oops, something went wrong.
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: 2 additions & 2 deletions
4
projects/js-packages/publicize-components/src/social-store/selectors/index.ts
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
26 changes: 26 additions & 0 deletions
26
...cts/js-packages/publicize-components/src/social-store/selectors/social-module-settings.ts
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,26 @@ | ||
import { store as coreStore } from '@wordpress/core-data'; | ||
import { createRegistrySelector } from '@wordpress/data'; | ||
import { getSocialScriptData } from '../../utils'; | ||
import { SocialModuleSettings } from '../types'; | ||
|
||
/** | ||
* Returns the Social module settings. | ||
*/ | ||
export const getSocialModuleSettings = createRegistrySelector( select => () => { | ||
const { socialToggleBase } = getSocialScriptData().api_paths; | ||
|
||
const data = select( coreStore ).getEntityRecord( 'jetpack/v4', socialToggleBase, undefined ); | ||
|
||
return ( data ?? { | ||
publicize: getSocialScriptData().is_publicize_enabled, | ||
} ) as SocialModuleSettings; | ||
} ); | ||
|
||
/** | ||
* Returns whether the Social module settings are being saved | ||
*/ | ||
export const isSavingSocialModuleSettings = createRegistrySelector( select => () => { | ||
const { socialToggleBase } = getSocialScriptData().api_paths; | ||
|
||
return select( coreStore ).isSavingEntityRecord( 'jetpack/v4', socialToggleBase, undefined ); | ||
} ); |
20 changes: 0 additions & 20 deletions
20
...cts/js-packages/publicize-components/src/social-store/selectors/social-plugin-settings.ts
This file was deleted.
Oops, something went wrong.
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
4 changes: 4 additions & 0 deletions
4
projects/packages/publicize/changelog/update-social-to-use-unified-settings-endpoint
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: patch | ||
Type: changed | ||
|
||
Update the settings endppoint to use existing endpoints |
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
Oops, something went wrong.