Skip to content

Commit 8f00c4d

Browse files
pablinosmatticbot
authored andcommitted
Social: Pass down description for Social previews (#35728)
* Pass down description to previews * changelog * Fixup versions * Use new package version * Uplift social-previews to beta.12 Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8024949880
1 parent 0903fbe commit 8f00c4d

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ This is an alpha version! The changes listed here are not final.
1212
### Added
1313
- Added toggle to Social admin page for the Social Notes
1414

15+
### Changed
16+
- Added description to social previews for titeless posts
17+
1518
### Removed
1619
- Removed a notice to tell users that instagram is new nad can be connected
1720

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@automattic/jetpack-components": "^0.48.4",
2323
"@automattic/jetpack-connection": "^0.32.3",
2424
"@automattic/jetpack-shared-extension-utils": "^0.14.2",
25-
"@automattic/social-previews": "2.0.1-beta.10",
25+
"@automattic/social-previews": "2.0.1-beta.12",
2626
"@wordpress/annotations": "2.51.0",
2727
"@wordpress/api-fetch": "6.48.0",
2828
"@wordpress/block-editor": "12.19.0",
@@ -50,7 +50,7 @@
5050
"@babel/core": "7.23.5",
5151
"@babel/plugin-transform-react-jsx": "7.23.4",
5252
"@babel/preset-react": "7.23.3",
53-
"@babel/runtime": "7.23.5",
53+
"@babel/runtime": "7.23.8",
5454
"@testing-library/dom": "9.3.4",
5555
"@testing-library/react": "14.2.0",
5656
"@testing-library/user-event": "14.5.2",

src/components/social-previews/instagram.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_INSTAGRAM_BUSINESS } from '../../so
1111
* @returns {React.ReactNode} The Instagram tab component.
1212
*/
1313
export function Instagram( props ) {
14-
const { title, image, media } = props;
14+
const { title, image, media, description } = props;
1515
const { username: name, profileImage } = useSelect( select =>
1616
select( SOCIAL_STORE_ID ).getConnectionProfileDetails( CONNECTION_SERVICE_INSTAGRAM_BUSINESS )
1717
);
1818

1919
const { message: text } = useSocialMediaMessage();
2020

21-
const caption = text || title;
21+
const caption = text || title || description;
2222

2323
return (
2424
<InstagramPreviews

src/components/social-previews/linkedin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_LINKEDIN } from '../../social-store
1212
* @returns {React.ReactNode} The linkedin tab component.
1313
*/
1414
export function LinkedIn( props ) {
15-
const { title, url, image, media } = props;
15+
const { title, url, image, media, description: postDescription } = props;
1616

1717
const { displayName: name, profileImage } = useSelect( select =>
1818
select( SOCIAL_STORE_ID ).getConnectionProfileDetails( CONNECTION_SERVICE_LINKEDIN )
@@ -21,7 +21,7 @@ export function LinkedIn( props ) {
2121
const { message: text } = useSocialMediaMessage();
2222

2323
// Add the URL to the description if there is media
24-
const description = `${ text || title } ${ media.length ? url : '' }`.trim();
24+
const description = `${ text || title || postDescription } ${ media.length ? url : '' }`.trim();
2525

2626
return (
2727
<LinkedInPreviews

src/components/social-previews/nextdoor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_NEXTDOOR } from '../../social-store
1111
* @returns {React.ReactNode} The linkedin tab component.
1212
*/
1313
export function Nextdoor( props ) {
14-
const { title, url, image, media } = props;
14+
const { title, url, image, media, description: postDescription } = props;
1515

1616
const { displayName: name, profileImage } = useSelect( select =>
1717
select( SOCIAL_STORE_ID ).getConnectionProfileDetails( CONNECTION_SERVICE_NEXTDOOR )
@@ -20,7 +20,7 @@ export function Nextdoor( props ) {
2020
const { message: text } = useSocialMediaMessage();
2121

2222
// Add the URL to the description if there is media
23-
const description = `${ text || title } ${ media.length ? url : '' }`.trim();
23+
const description = `${ text || title || postDescription } ${ media.length ? url : '' }`.trim();
2424

2525
return (
2626
<NextdoorPreviews

0 commit comments

Comments
 (0)