mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Enabled product options for email recipient segment
refs https://github.com/TryGhost/Team/issues/801
refs 0caa539330
- adds back product options to email recipient segment filter in publish menu
This commit is contained in:
parent
3c5e334041
commit
f9a25d4e41
@ -13,6 +13,7 @@ export default class GhMembersRecipientSelect extends Component {
|
||||
@service membersUtils;
|
||||
@service session;
|
||||
@service store;
|
||||
@service feature;
|
||||
|
||||
baseFilters = new TrackedSet();
|
||||
specificFilters = new TrackedSet();
|
||||
@ -144,6 +145,29 @@ export default class GhMembersRecipientSelect extends Component {
|
||||
|
||||
options.push(labelsGroup);
|
||||
}
|
||||
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'});
|
||||
|
||||
if (products.length > 1) {
|
||||
const productsGroup = {
|
||||
groupName: 'Products',
|
||||
options: []
|
||||
};
|
||||
|
||||
products.forEach((product) => {
|
||||
productsGroup.options.push({
|
||||
name: product.name,
|
||||
segment: `product:${product.slug}`,
|
||||
count: product.count?.members,
|
||||
class: 'segment-product'
|
||||
});
|
||||
});
|
||||
|
||||
options.push(productsGroup);
|
||||
}
|
||||
}
|
||||
|
||||
this.specificOptions = options;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default class GhMembersSegmentSelect extends Component {
|
||||
@service store;
|
||||
@service feature;
|
||||
|
||||
@tracked _options = [];
|
||||
|
||||
@ -89,27 +90,28 @@ export default class GhMembersSegmentSelect extends Component {
|
||||
|
||||
options.push(labelsGroup);
|
||||
}
|
||||
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'});
|
||||
|
||||
// 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'});
|
||||
if (products.length > 0) {
|
||||
const productsGroup = {
|
||||
groupName: 'Products',
|
||||
options: []
|
||||
};
|
||||
|
||||
if (products.length > 0) {
|
||||
const productsGroup = {
|
||||
groupName: 'Products',
|
||||
options: []
|
||||
};
|
||||
|
||||
products.forEach((product) => {
|
||||
productsGroup.options.push({
|
||||
name: product.name,
|
||||
segment: `product:${product.slug}`,
|
||||
count: product.count?.members,
|
||||
class: 'segment-product'
|
||||
products.forEach((product) => {
|
||||
productsGroup.options.push({
|
||||
name: product.name,
|
||||
segment: `product:${product.slug}`,
|
||||
count: product.count?.members,
|
||||
class: 'segment-product'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
options.push(productsGroup);
|
||||
options.push(productsGroup);
|
||||
}
|
||||
}
|
||||
|
||||
this._options = options;
|
||||
|
Loading…
Reference in New Issue
Block a user