From 98c9d8adc56f4ae18374253d751d87f861c2c4c0 Mon Sep 17 00:00:00 2001 From: Moon Date: Wed, 8 Dec 2021 19:08:47 -0800 Subject: [PATCH] Do not truncate notes created before WC 6.1 release (https://github.com/woocommerce/woocommerce-admin/pull/8023) * Do not truncate notes created before WC 5.9 release * Change WC version number --- .../client/inbox-panel/index.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce-admin/client/inbox-panel/index.js b/plugins/woocommerce-admin/client/inbox-panel/index.js index 8e79b4b260a..8016ea4492e 100644 --- a/plugins/woocommerce-admin/client/inbox-panel/index.js +++ b/plugins/woocommerce-admin/client/inbox-panel/index.js @@ -19,7 +19,7 @@ import { InboxNotePlaceholder, Text, } from '@woocommerce/experimental'; - +import moment from 'moment'; /** * Internal dependencies */ @@ -181,10 +181,24 @@ const InboxPanel = ( { showHeader = true } ) => { isResolving, isNotesRequesting, } = select( NOTES_STORE_NAME ); + const WC_VERSION_61_RELEASE_DATE = moment( + '2022-01-11', + 'YYYY-MM-DD' + ).valueOf(); return { notes: getNotes( INBOX_QUERY ).map( ( note ) => { - note.content = truncateRenderableHTML( note.content, 320 ); + const noteDate = moment( + note.date_created_gmt, + 'YYYY-MM-DD' + ).valueOf(); + + if ( noteDate >= WC_VERSION_61_RELEASE_DATE ) { + note.content = truncateRenderableHTML( + note.content, + 320 + ); + } return note; } ), isError: Boolean(