diff --git a/src/components/Avatar/Avatar.js b/src/components/Avatar/Avatar.js
index 48ff31cc..2af17ce4 100644
--- a/src/components/Avatar/Avatar.js
+++ b/src/components/Avatar/Avatar.js
@@ -12,8 +12,6 @@ const Avatar = props => {
const avatarUser = ensureUser(user);
const { displayName, abbreviatedName } = avatarUser.attributes.profile;
- // TODO this is a temporary avatar fix for currentUser's profile data.
- // Avatar images should be included to all user's attributes in the future.
if (avatarUser.profileImage && avatarUser.profileImage.id) {
return (
@@ -21,7 +19,10 @@ const Avatar = props => {
rootClassName={css.avatarImage}
alt={displayName}
image={avatarUser.profileImage}
- nameSet={[{ name: 'square-xlarge', size: '1x' }, { name: 'square-xlarge2x', size: '2x' }]}
+ nameSet={[
+ { name: 'square-xlarge2x', size: '1x' },
+ { name: 'square-xlarge4x', size: '2x' },
+ ]}
/>
);
diff --git a/src/containers/InboxPage/InboxPage.duck.js b/src/containers/InboxPage/InboxPage.duck.js
index 3c2a36ab..daba0363 100644
--- a/src/containers/InboxPage/InboxPage.duck.js
+++ b/src/containers/InboxPage/InboxPage.duck.js
@@ -90,7 +90,13 @@ export const loadData = (params, search) =>
const apiQueryParams = {
only: onlyFilter,
- include: ['provider', 'customer', 'booking'],
+ include: [
+ 'provider',
+ 'provider.profileImage',
+ 'customer',
+ 'customer.profileImage',
+ 'booking',
+ ],
page,
per_page: INBOX_PAGE_SIZE,
};
diff --git a/src/containers/ListingPage/ListingPage.duck.js b/src/containers/ListingPage/ListingPage.duck.js
index 12ece99f..7230fa28 100644
--- a/src/containers/ListingPage/ListingPage.duck.js
+++ b/src/containers/ListingPage/ListingPage.duck.js
@@ -45,7 +45,7 @@ export const showListing = listingId =>
dispatch(showListingRequest(listingId));
dispatch(fetchCurrentUser());
return sdk.listings
- .show({ id: listingId, include: ['author', 'images'] })
+ .show({ id: listingId, include: ['author', 'author.profileImage', 'images'] })
.then(data => {
dispatch(addMarketplaceEntities(data));
return data;
diff --git a/src/containers/ListingPage/ListingPage.test.js b/src/containers/ListingPage/ListingPage.test.js
index edcceabc..e2663488 100644
--- a/src/containers/ListingPage/ListingPage.test.js
+++ b/src/containers/ListingPage/ListingPage.test.js
@@ -52,7 +52,7 @@ describe('ListingPage', () => {
return showListing(id)(dispatch, null, sdk).then(data => {
expect(data).toEqual(response);
- expect(show.mock.calls).toEqual([[{ id, include: ['author', 'images'] }]]);
+ expect(show.mock.calls).toEqual([[{ id, include: ['author', 'author.profileImage', 'images'] }]]);
expect(dispatch.mock.calls).toEqual([
[showListingRequest(id)],
[expect.anything()], // fetchCurrentUser() call
@@ -76,7 +76,7 @@ describe('ListingPage', () => {
},
e => {
expect(e).toEqual(error);
- expect(show.mock.calls).toEqual([[{ id, include: ['author', 'images'] }]]);
+ expect(show.mock.calls).toEqual([[{ id, include: ['author', 'author.profileImage', 'images'] }]]);
expect(dispatch.mock.calls).toEqual([
[showListingRequest(id)],
[expect.anything()], // fetchCurrentUser() call
diff --git a/src/containers/OrderPage/OrderPage.duck.js b/src/containers/OrderPage/OrderPage.duck.js
index 4eaf7ae7..0f5c2d2a 100644
--- a/src/containers/OrderPage/OrderPage.duck.js
+++ b/src/containers/OrderPage/OrderPage.duck.js
@@ -57,7 +57,10 @@ export const fetchOrder = id =>
txResponse = response;
const listingId = listingRelationship(response).id;
- return sdk.listings.show({ id: listingId, include: ['author', 'images'] });
+ return sdk.listings.show({
+ id: listingId,
+ include: ['author', 'author.profileImage', 'images'],
+ });
})
.then(response => {
dispatch(addMarketplaceEntities(txResponse));
diff --git a/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js b/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js
index 560b3886..1440460e 100644
--- a/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js
+++ b/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js
@@ -133,8 +133,7 @@ export const updateProfile = actionPayload => {
.then(response => {
dispatch(updateProfileSuccess(response));
- // Temporary denormalization for profileImage
- // Profile image will be included to users
+ // Include profile image to denormalized user entity
const currentUserId = response.data.data.id;
const entities = updatedEntities({}, response.data);
const denormalised = denormalisedEntities(entities, 'current-user', [currentUserId]);
diff --git a/src/containers/SalePage/SalePage.duck.js b/src/containers/SalePage/SalePage.duck.js
index c9fbf02b..d04a6a56 100644
--- a/src/containers/SalePage/SalePage.duck.js
+++ b/src/containers/SalePage/SalePage.duck.js
@@ -91,11 +91,27 @@ export const fetchSale = id =>
let txResponse = null;
return sdk.transactions
- .show({ id, include: ['customer', 'provider', 'listing', 'booking'] }, { expand: true })
+ .show(
+ {
+ id,
+ include: [
+ 'customer',
+ 'customer.profileImage',
+ 'provider',
+ 'provider.profileImage',
+ 'listing',
+ 'booking',
+ ],
+ },
+ { expand: true }
+ )
.then(response => {
txResponse = response;
const listingId = listingRelationship(response).id;
- return sdk.listings.show({ id: listingId, include: ['author', 'images'] });
+ return sdk.listings.show({
+ id: listingId,
+ include: ['author', 'author.profileImage', 'images'],
+ });
})
.then(response => {
dispatch(addMarketplaceEntities(txResponse));
diff --git a/src/ducks/user.duck.js b/src/ducks/user.duck.js
index 9a6b10b6..90dbe822 100644
--- a/src/ducks/user.duck.js
+++ b/src/ducks/user.duck.js
@@ -321,8 +321,7 @@ export const fetchCurrentUser = () =>
return sdk.currentUser
.show({ include: ['profileImage'] })
.then(response => {
- // Temporary denormalization for profileImage
- // Profile image will be included to users
+ // Include profile image to denormalized user entity
const currentUserId = response.data.data.id;
const entities = updatedEntities({}, response.data);
const denormalised = denormalisedEntities(entities, 'current-user', [currentUserId]);