fix: adding blocks from block builder to the changes field (#35603)

pull/35665/head
Gustavo Reis Bauer 10 months ago committed by Diego Sampaio
parent 48d71ecfea
commit d7ea246e0f
No known key found for this signature in database
GPG Key ID: B71D302EB7F5183C
  1. 6
      .changeset/three-olives-explain.md
  2. 10
      packages/apps-engine/deno-runtime/lib/accessors/builders/MessageBuilder.ts

@ -0,0 +1,6 @@
---
"@rocket.chat/apps-engine": patch
"@rocket.chat/meteor": patch
---
Fixes an issue where apps where not able to update messages using the BlockBuilder.

@ -223,12 +223,10 @@ export class MessageBuilder implements IMessageBuilder {
}
public setBlocks(blocks: BlockBuilder | Array<IBlock | LayoutBlock>) {
if (blocks instanceof BlockBuilder) {
this.msg.blocks = blocks.getBlocks();
} else {
this.msg.blocks = blocks;
this.changes.blocks = blocks;
}
const blockArray: Array<IBlock | LayoutBlock> = blocks instanceof BlockBuilder ? blocks.getBlocks() : blocks;
this.msg.blocks = blockArray;
this.changes.blocks = blockArray;
return this as IMessageBuilder;
}

Loading…
Cancel
Save