Fix multi image upload deleting old links

This commit is contained in:
Alexandre Bodin 2019-09-11 16:07:30 +02:00
parent 836920b4f8
commit 2d65ebeade

View File

@ -270,9 +270,11 @@ module.exports = {
: null
);
const reverseAssoc = model.associations.find(assoc => assoc.alias === obj.field);
// Remove existing relationship because only one file
// can be related to this field.
if (association.nature === 'manyMorphToOne') {
if (reverseAssoc && reverseAssoc.nature === 'oneToManyMorph') {
relationUpdates.push(
module.exports.removeRelationMorph
.call(