Fixed product benefits not loaded on memberships settings

refs https://github.com/TryGhost/Team/issues/905

- benefits were overridden with a secondary products query for segment select which did not have proper includes
- fixes includes for products when fetched for member segments
This commit is contained in:
Rishabh 2021-09-17 12:41:39 +05:30
parent 2b0d1ee357
commit 03b37b05fb
2 changed files with 2 additions and 3 deletions

View File

@ -97,7 +97,7 @@ export default class GhMembersSegmentSelect extends Component {
if (this.feature.get('multipleProducts')) {
// fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶
// TODO: add `include: 'count.members` to query once API supports
const products = yield this.store.query('product', {limit: 'all'});
const products = yield this.store.query('product', {limit: 'all', include: 'monthly_price,yearly_price,benefits'});
if (products.length > 0) {
const productsGroup = {

View File

@ -3,13 +3,12 @@ import Transform from '@ember-data/serializer/transform';
import {A as emberA, isArray as isEmberArray} from '@ember/array';
export default Transform.extend({
deserialize(serialized, options) {
deserialize(serialized) {
let benefitsItems, benefitsArray;
benefitsArray = serialized || [];
benefitsItems = benefitsArray.map((itemDetails) => {
itemDetails.isSecondary = options && options.isSecondary || false;
return ProductBenefitItem.create(itemDetails);
});