File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ class LightLivePreviewHoC {
7171}
7272
7373const ContentstackLivePreview =
74- process . env . PURGE_PREVIEW_SDK || process . env . REACT_APP_PURGE_PREVIEW_SDK
74+ typeof process !== "undefined" &&
75+ ( process ?. env ?. PURGE_PREVIEW_SDK === "true" ||
76+ process ?. env ?. REACT_APP_PURGE_PREVIEW_SDK === "true" )
7577 ? LightLivePreviewHoC
7678 : ContentstackLivePreviewHOC ;
7779
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ export class PublicLogger {
88 | Console [ "info" ] ,
99 message : any [ ]
1010 ) : void {
11- if ( process ?. env ?. NODE_ENV !== "test" ) {
11+ if (
12+ typeof process !== "undefined" &&
13+ process ?. env ?. NODE_ENV !== "test"
14+ ) {
1215 logCallback ( "Live_Preview_SDK:" , ...message ) ;
1316 }
1417 }
Original file line number Diff line number Diff line change @@ -90,13 +90,17 @@ export const getMessageWithDisplayName = (
9090
9191 let tempText = sanitizeData ( comment . message ) . replace ( / < [ ^ > ] * > / g, "" ) ;
9292
93- comment ? .toUsers ?. forEach ( ( user ) => {
93+ comment . toUsers ?. forEach ( ( user ) => {
9494 const userPattern = new RegExp ( `{{${ user } }}` , "g" ) ;
9595 const userData = userState . userMap [ user ] ;
96+ const displayName = userData
97+ ? userData . display || getUserName ( userData )
98+ : `unknown user` ;
99+
96100 const replacement =
97101 profile === "html"
98- ? `<b class="collab-thread-comment--message">@${ userData . display || getUserName ( userData ) } </b>`
99- : `@${ userData . display || getUserName ( userData ) } ` ;
102+ ? `<b class="collab-thread-comment--message">@${ displayName } </b>`
103+ : `@${ displayName } ` ;
100104 tempText = tempText . replace ( userPattern , replacement ) ;
101105 } ) ;
102106
You can’t perform that action at this time.
0 commit comments