@@ -35,6 +35,7 @@ import {
3535import { dataTest } from "../../lib/attributes" ;
3636import ContactToolbar from "./ContactToolbar" ;
3737import { getCookie , setCookie } from "../../lib/cookie" ;
38+ import { deepCopy } from "../utils" ;
3839
3940export class AssignmentTexterContactControls extends React . Component {
4041 constructor ( props ) {
@@ -124,7 +125,10 @@ export class AssignmentTexterContactControls extends React.Component {
124125 let currentInteractionStep = null ;
125126
126127 if ( availableSteps . length > 0 ) {
127- currentInteractionStep = availableSteps [ availableSteps . length - 1 ] ;
128+ const currentInteractionStep = deepCopy (
129+ availableSteps [ availableSteps . length - 1 ]
130+ ) ;
131+
128132 currentInteractionStep . question . filteredAnswerOptions =
129133 currentInteractionStep . question . answerOptions ;
130134 }
@@ -508,8 +512,8 @@ export class AssignmentTexterContactControls extends React.Component {
508512
509513 const otherResponsesLink =
510514 currentInteractionStep &&
511- currentInteractionStep . question . filteredAnswerOptions . length > 6 &&
512- filteredCannedResponses . length ? (
515+ currentInteractionStep . question . filteredAnswerOptions . length > 6 &&
516+ filteredCannedResponses . length ? (
513517 < div className = { css ( flexStyles . popoverLink ) } key = { "otherresponses" } >
514518 < a
515519 href = "#otherresponses"
@@ -522,8 +526,8 @@ export class AssignmentTexterContactControls extends React.Component {
522526
523527 const searchBar = currentInteractionStep &&
524528 currentInteractionStep . question . answerOptions . length +
525- campaign . cannedResponses . length >
526- 5 && (
529+ campaign . cannedResponses . length >
530+ 5 && (
527531 < SearchBar
528532 onRequestSearch = { this . handleSearchChange }
529533 onChange = { this . handleSearchChange }
@@ -661,12 +665,12 @@ export class AssignmentTexterContactControls extends React.Component {
661665 margin : "9px" ,
662666 color :
663667 this . state . optOutMessageText ===
664- this . props . campaign . organization . optOutMessage
668+ this . props . campaign . organization . optOutMessage
665669 ? "white"
666670 : "#494949" ,
667671 backgroundColor :
668672 this . state . optOutMessageText ===
669- this . props . campaign . organization . optOutMessage
673+ this . props . campaign . organization . optOutMessage
670674 ? "#727272"
671675 : "white"
672676 } }
@@ -879,9 +883,9 @@ export class AssignmentTexterContactControls extends React.Component {
879883 shortCannedResponses = shortCannedResponses . filter ( script => {
880884 var textLength = global . HIDE_BRANCHED_SCRIPTS
881885 ? this . getShortButtonText (
882- script . title ,
883- cannedResponseScript ? 40 : 13
884- ) . length
886+ script . title ,
887+ cannedResponseScript ? 40 : 13
888+ ) . length
885889 : script . title . length ;
886890
887891 if ( joinedLength + 1 + textLength < 80 ) {
@@ -965,7 +969,7 @@ export class AssignmentTexterContactControls extends React.Component {
965969 < div className = { css ( flexStyles . subButtonsExitButtons ) } >
966970 < Button
967971 onClick = {
968- ! disabled ? this . handleOpenAnswerResponsePopover : noAction => { }
972+ ! disabled ? this . handleOpenAnswerResponsePopover : noAction => { }
969973 }
970974 style = { {
971975 backgroundColor : this . props . muiTheme . palette . background . default ,
@@ -1197,40 +1201,40 @@ export class AssignmentTexterContactControls extends React.Component {
11971201 const content = firstMessage
11981202 ? this . renderFirstMessage ( enabledSideboxes )
11991203 : [
1200- this . renderToolbar ( enabledSideboxes ) ,
1201- < div
1202- key = "superSectionMessagePage"
1203- className = { css ( flexStyles . superSectionMessagePage ) }
1204- >
1205- { this . state . contactListOpen &&
1206- this . renderAssignmentContactsList (
1207- this . props . assignment . contacts ,
1208- this . props . contact ,
1209- this . props . updateCurrentContactById
1210- ) }
1211- < div className = { css ( flexStyles . superSectionMessageListAndControls ) } >
1212- < ContactToolbar
1213- campaignContact = { this . props . contact }
1214- campaign = { this . props . campaign }
1215- navigationToolbarChildren = { this . props . navigationToolbarChildren }
1216- toggleContactList = { this . toggleContactList }
1217- />
1218- { this . renderMessageBox (
1219- < MessageList
1220- contact = { this . props . contact }
1221- currentUser = { this . props . currentUser }
1222- messages = { this . props . contact . messages }
1223- organizationId = { this . props . organizationId }
1224- review = { this . props . review }
1225- styles = { messageListStyles }
1226- hideMedia = { this . state . hideMedia }
1227- /> ,
1228- enabledSideboxes
1229- ) }
1230- { this . renderMessageControls ( enabledSideboxes ) }
1204+ this . renderToolbar ( enabledSideboxes ) ,
1205+ < div
1206+ key = "superSectionMessagePage"
1207+ className = { css ( flexStyles . superSectionMessagePage ) }
1208+ >
1209+ { this . state . contactListOpen &&
1210+ this . renderAssignmentContactsList (
1211+ this . props . assignment . contacts ,
1212+ this . props . contact ,
1213+ this . props . updateCurrentContactById
1214+ ) }
1215+ < div className = { css ( flexStyles . superSectionMessageListAndControls ) } >
1216+ < ContactToolbar
1217+ campaignContact = { this . props . contact }
1218+ campaign = { this . props . campaign }
1219+ navigationToolbarChildren = { this . props . navigationToolbarChildren }
1220+ toggleContactList = { this . toggleContactList }
1221+ />
1222+ { this . renderMessageBox (
1223+ < MessageList
1224+ contact = { this . props . contact }
1225+ currentUser = { this . props . currentUser }
1226+ messages = { this . props . contact . messages }
1227+ organizationId = { this . props . organizationId }
1228+ review = { this . props . review }
1229+ styles = { messageListStyles }
1230+ hideMedia = { this . state . hideMedia }
1231+ /> ,
1232+ enabledSideboxes
1233+ ) }
1234+ { this . renderMessageControls ( enabledSideboxes ) }
1235+ </ div >
12311236 </ div >
1232- </ div >
1233- ] ;
1237+ ] ;
12341238 return (
12351239 < div
12361240 className = { css ( flexStyles . topContainer ) }
0 commit comments