Repository navigation
fix(dynamic-images): find the contact by its id when rendering - #1827
Merged
Merged
Conversation
Flows fill a dynamic image link's {{user_id}} with the contact's own id
(Contact.id) since #1071, but the /dynamic-images route still looked it up
as the channel-side ContactInbox.sourceId. No contact ever matched, so every
send fell back to the static background and showed only the leading static
layers (usually just the template picture).
The route now resolves the contact through
dynamicImageService.resolveContactInbox: by Contact.id first, then by
sourceId for links sent before the change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
A dynamic image sent through a flow showed only the template picture. Every other layer was missing: text (plain and
{{variable}}), avatar or custom-field images, and QR codes.Since #1071, flows fill the link's
{{user_id}}with the contact's own id (Contact.id). The/dynamic-imagesroute still looked that value up as the channel-sideContactInbox.sourceId, so no contact ever matched. The route then fell back to the static background. That background holds only the leading run of static layers, which is usually just the template, because every layer after the first dynamic one is drawn per contact.Fix
dynamicImageService.resolveContactInbox({ workspaceId, userId }). It looks up the contact byContact.idfirst (only for ids within the Postgres bigint range), then falls back tosourceIdso links sent before fix(variables): resolve user_id system field to the contact id #1071 keep working.userIdas the channel id is corrected.imageUrldescription now says{{user_id}}is the contact's id.Tests
packages/business/__tests__/dynamic-image-resolve-contact.test.ts: lookup by contact id, fallback to source id, non-numeric and out-of-range ids, no match.apps/builder/__tests__/dynamic-images-route.test.ts: renders for a matched contact; serves the background when none matches.pnpm lint, builder and businesscheck-types, and the dynamic-image and public-spec tests all pass.🤖 Generated with Claude Code