diff --git a/CHANGELOG.md b/CHANGELOG.md index a45db02449..9a2a997b2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2020-XX-XX +- [fix] Pass metadata through sanitizeUser function. + [#1391](https://github.com/sharetribe/ftw-daily/pull/1391) - [fix] Call for the same page caused unnecessary rendering [#1388](https://github.com/sharetribe/ftw-daily/pull/1388) - [fix] Fix Google Maps default centering if no bounds or center is given. diff --git a/src/util/sanitize.js b/src/util/sanitize.js index 3a3d221239..163f07a611 100644 --- a/src/util/sanitize.js +++ b/src/util/sanitize.js @@ -34,12 +34,17 @@ const sanitizeText = str => export const sanitizeUser = entity => { const { attributes, ...restEntity } = entity || {}; const { profile, ...restAttributes } = attributes || {}; - const { bio, displayName, abbreviatedName, publicData } = profile || {}; + const { bio, displayName, abbreviatedName, publicData, metadata } = profile || {}; const sanitizePublicData = publicData => { // TODO: If you add public data, you should probably sanitize it here. return publicData ? { publicData } : {}; }; + const sanitizeMetadata = metadata => { + // TODO: If you add user-generated metadata through Integration API, + // you should probably sanitize it here. + return metadata ? { metadata } : {}; + }; const profileMaybe = profile ? { @@ -48,6 +53,7 @@ export const sanitizeUser = entity => { displayName: sanitizeText(displayName), bio: sanitizeText(bio), ...sanitizePublicData(publicData), + ...sanitizeMetadata(metadata), }, } : {};