@@ -40,7 +40,7 @@ async function onTypicalReplyButtonClicked(event) {
4040 "conversationId" ,
4141 Office . context . mailbox . item . conversationId ?? ""
4242 ) ;
43- Office . context . roamingSettings . set ( "actionId " , actionId ) ;
43+ Office . context . roamingSettings . set ( "buttonconfig " , JSON . stringify ( buttonConfig ) ) ;
4444 await OfficeDataAccessHelper . saveRoamingSettingsAsync ( ) ;
4545 const attachments = ReplayMailDataCreator . getAttachments ( { buttonConfig, originalMailData } ) ;
4646 const replyFormFunction = ReplayMailDataCreator . getReplyFormFunction ( buttonConfig ) ;
@@ -64,23 +64,22 @@ window.onTypicalReplyButtonClicked = onTypicalReplyButtonClicked;
6464
6565async function onNewMessageComposeCreated ( event ) {
6666 const conversationId = Office . context . mailbox . item . conversationId ;
67- const actionId = Office . context . roamingSettings . get ( "actionId" ) ?. trim ( ) ?? "" ;
67+ const buttonConfigString = Office . context . roamingSettings . get ( "buttonconfig" ) ?. trim ( ) ?? "" ;
68+ if ( ! buttonConfigString ) {
69+ return event . completed ( ) ;
70+ }
6871 const targetConversationId = Office . context . roamingSettings . get ( "conversationId" ) ?. trim ( ) ?? "" ;
69- console . debug ( "action id: " + actionId ) ;
70- console . debug ( "targetConversation id: " + targetConversationId ) ;
72+ const buttonConfig = JSON . parse ( buttonConfigString ) ;
7173 if ( conversationId !== targetConversationId ) {
7274 return event . completed ( ) ;
7375 }
74- const buttonConfig = await ConfigLoader . loadButtonConfig (
75- Office . context . displayLanguage ,
76- actionId
77- ) ;
76+ console . debug ( "conversation id matched." ) ;
7877 Office . context . roamingSettings . remove ( "conversationId" ) ;
79- Office . context . roamingSettings . remove ( "actionId " ) ;
78+ Office . context . roamingSettings . remove ( "buttonconfig " ) ;
8079 await OfficeDataAccessHelper . saveRoamingSettingsAsync ( ) ;
8180
8281 const originalSubject = await OfficeDataAccessHelper . getSubjectAsync ( ) ;
83- const newSubject = await ReplayMailDataCreator . createSubject ( { buttonConfig, originalSubject } ) ;
82+ const newSubject = ReplayMailDataCreator . createSubject ( { buttonConfig, originalSubject } ) ;
8483 await OfficeDataAccessHelper . setSubjectAsync ( newSubject ) ;
8584 const recipients = ReplayMailDataCreator . getNewRecipients ( buttonConfig ) ;
8685 if ( recipients . to ) {
0 commit comments