mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
🐛 Fixed error on saving member with existing label
closes https://github.com/TryGhost/Team/issues/743 Unlike tags, a label has a unique constraint on its `name`. So saving a new label on member with the same name as existing label fails with error due to unique constraint error. - adds id for new label to match existing label if they are the same name, which avoids creating a new label
This commit is contained in:
parent
768709ce88
commit
07dd783a40
@ -155,6 +155,7 @@ const Member = ghostBookshelf.Model.extend({
|
||||
return label.name.toLowerCase() === lab.get('name').toLowerCase();
|
||||
});
|
||||
label.name = (existingLabel && existingLabel.get('name')) || label.name;
|
||||
label.id = (existingLabel && existingLabel.id) || label.id;
|
||||
});
|
||||
|
||||
model.set('labels', labelsToSave);
|
||||
|
Loading…
Reference in New Issue
Block a user