Skip to content

Commit

Permalink
All changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aishik-biswas committed Oct 5, 2023
1 parent 3ef0767 commit 5204da4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/marketplace-models/src/types/PayloadData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface Channel {

export interface UserProperty {
name: string;
oldName?: string;
value: string;
}

Expand Down
5 changes: 5 additions & 0 deletions packages/rule-engine/src/ActionExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ export class ActionExecutor {
user.properties.forEach((userProperty) => {
const placeholderKey = `user.properties.${userProperty.name}`;
dynamicPlaceholders[placeholderKey] = userProperty.value;
// For backward compatibility with migrated accounts
if (userProperty.oldName) {
const oldPlaceholderKey = `user.properties.${userProperty.oldName}`;
dynamicPlaceholders[oldPlaceholderKey] = userProperty.value;
}
});

return { ...placeholders, ...dynamicPlaceholders };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const evaluateUserPropertyCondition = (
ruleAlias: string,
): Promise<void> => {
const matchedProperty =
userObj.properties && userObj.properties.find((property) => property.name === conditionValue.propertyKey);
userObj.properties &&
userObj.properties.find(
(property) => property.name === conditionValue.propertyKey || property.oldName === conditionValue.propertyKey,
);

return Utils.evaluateCondition(
operator,
Expand Down

0 comments on commit 5204da4

Please sign in to comment.