Repository navigation
Implement logic which allow to force clear blocks or attachments on message update. - #486
Merged
yyakhnytsia merged 2 commits intoOct 14, 2026
Conversation
added 2 commits
October 14, 2026 09:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Slack's
chat.updatekeeps a field when it's omitted and clears it only when sent as[]. SinceChatUpdateMessageParamsis@JsonInclude(NON_EMPTY), an emptyattachments/blockslist is dropped — so there's currently no way to clear attachments or blocks via the typed client. This blocks updating a message from one representation to another (e.g. legacyattachments→ Block Kitblocks): the old field lingers and the message renders both stacked.What changed
ChatUpdateMessageParamsIF— two@JsonIgnore @Default falseflags,shouldClearAttachments()/shouldClearBlocks(). When set, the field serializes as[]; default-off means serialization is unchanged for all existing callers.ForceEmitPropertyWriter(new) —BeanPropertyWriterthat force-emits an empty field when the flag is set, else defers to the default writer.ChatUpdateMessageParamsSerializerModifier(new) —BeanSerializerModifierthat swaps only theattachments/blockswriters onChatUpdateMessageParams; all other fields keep their default writers.ObjectMapperUtils— registers the modifier on the shared mapper (early-returns for every other type).Testing
ChatUpdateMessageParamsSerializationTest: 13 tests (omit-when-off, emit-[]-when-on, non-empty preserved, flag independence, flags don't leak, drift guard, other-types-untouched). Fullslack-basesuite: 369/369 pass.