Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #364 from beabee-communityrm/fix/limit-callout-res…
Browse files Browse the repository at this point in the history
…ponses

fix: callout map responses
  • Loading branch information
wpf500 authored Feb 16, 2024
2 parents 017ef98 + 0ebd144 commit 552d3fc
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/api/transformers/CalloutResponseMapTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ class CalloutResponseMapTransformer extends BaseCalloutResponseTransformer<
if (answer) {
// answers[slideId] will definitely be defined
answers[component.slideId]![component.key] = answer;
}

// Extract title, address and image answers
if (component.fullKey === titleProp) {
title = stringifyAnswer(component, answer);
}
if (component.fullKey === map?.addressProp) {
address = Array.isArray(answer) ? answer[0] : answer;
}
if (component.fullKey === imageProp) {
images = Array.isArray(answer) ? answer : [answer];
// Extract title, address and image answers
if (component.fullKey === titleProp) {
title = stringifyAnswer(component, answer);
}
if (component.fullKey === map?.addressProp) {
address = Array.isArray(answer) ? answer[0] : answer;
}
if (component.fullKey === imageProp && answer) {
images = Array.isArray(answer) ? answer : [answer];
}
}
}

Expand Down Expand Up @@ -96,6 +95,12 @@ class CalloutResponseMapTransformer extends BaseCalloutResponseTransformer<
operator: "equal",
value: [bucket]
}))
},
// Only load responses for the given callout
{
field: "callout",
operator: "equal",
value: [query.callout.slug]
}
])
};
Expand Down

0 comments on commit 552d3fc

Please sign in to comment.