Skip to content

Commit b40aab3

Browse files
committed
fix(agentmail): guard replyTo and thread label remappings with operation checks
1 parent 6feb010 commit b40aab3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/sim/blocks/blocks/agentmail.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ export const AgentMailBlock: BlockConfig = {
484484
updateMessageId,
485485
msgAddLabels,
486486
msgRemoveLabels,
487+
addLabels,
488+
removeLabels,
487489
draftInReplyTo,
488490
...rest
489491
} = params
@@ -504,7 +506,7 @@ export const AgentMailBlock: BlockConfig = {
504506
rest.messageId = replyMessageId
505507
}
506508

507-
if (replyTo) {
509+
if (operation === 'reply_message' && replyTo) {
508510
rest.to = replyTo
509511
} else if (operation === 'reply_message') {
510512
rest.to = undefined
@@ -526,6 +528,14 @@ export const AgentMailBlock: BlockConfig = {
526528
rest.removeLabels = msgRemoveLabels
527529
}
528530

531+
if (operation === 'update_thread' && addLabels) {
532+
rest.addLabels = addLabels
533+
}
534+
535+
if (operation === 'update_thread' && removeLabels) {
536+
rest.removeLabels = removeLabels
537+
}
538+
529539
if (draftInReplyTo) {
530540
rest.inReplyTo = draftInReplyTo
531541
}

0 commit comments

Comments
 (0)