allow suggestions to target multiple contexts:

If an array of context strings is specified in json, the suggestion will
be available for display in all specified contexts.
This commit is contained in:
haszari 2019-02-25 15:27:14 +13:00
parent 041068a705
commit 1df74d504e
1 changed files with 3 additions and 0 deletions

View File

@ -198,6 +198,9 @@
function getRelevantPromotions( marketplaceSuggestionsApiData, displayContext ) {
// select based on display context
var promos = _.filter( marketplaceSuggestionsApiData, function( promo ) {
if ( _.isArray( promo.context ) ) {
return _.contains( promo.context, displayContext );
}
return ( displayContext === promo.context );
} );