how to changes this code: there is a version difference.
preferredDeliveryChannelComp: computed(function () { const preferredChannels = this.get(‘otvc.deliveryChannels’).filterBy(‘preferred’); if (preferredChannels.length > 0){ const preferredChannelId = preferredChannels[0].id; this.get(‘otvc’).setChannel(preferredChannelId); //set the selected option in memory return preferredChannelId; } }),
to equivalent to this one: preferredDeliveryChannelComp: computed(‘showPushOption’, function () { const preferredChannels = this.get(‘otvc.deliveryChannels’) .filter(channel => channel.get(‘preferred’) && channel.get(‘type’) !== ‘PUSH’);
if (this.get('showPushOption')) {
return this.get('otvc.pushEnabledDeviceId');
} else if (preferredChannels.length > 0) {
const preferredChannelId = preferredChannels[0].id;
this.get('otvc').setChannel(preferredChannelId); //set the selected option in memory
return preferredChannelId;
}
}),
1 post - 1 participant