Skip to content

Commit

Permalink
[5.3] MSPB-367: Avoid removing duplicated feature codes (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
masmerino13 authored and guillegr123 committed Nov 8, 2024
1 parent 2cbb0e6 commit d4f5ca4
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions submodules/strategy/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2970,19 +2970,30 @@ define(function(require) {
}
}, callback);
},
function maybeDeleteWrongFeatureCodes(existing, callback) {
monster.parallel(_
/**
* We need to validate if there are duplicated feature codes
* if duplicated, the ones created outside of SmartPBX will be removed
*/
function validateDuplicatedFeatureCodes(existing, callback) {
existing.duplicated = _
.chain(existing.createdOutsideApp)
.filter(function(callflow) {
return _.some(self.featureCodeConfigs, _.flow([
_.unary(_.partial(_.get, _, 'name')),
return _.some(existing.createdByApp, _.flow([
_.unary(_.partial(_.get, _, 'featurecode.name')),
_.partial(_.isEqual, _.get(callflow, 'featurecode.name'))
]));
})
.value();

callback(null, existing);
},
function maybeDeleteWrongFeatureCodes(existing, callback) {
monster.parallel(_
.chain(existing.duplicated)
.map(deleteFeatureCodeFactory)
.value()
, function() {
callback(null, existing.createdByApp);
callback(null, _.concat(existing.createdByApp, existing.createdOutsideApp));
});
},
function maybeCreateMissingFeatureCodes(existing, callback) {
Expand Down

0 comments on commit d4f5ca4

Please sign in to comment.