mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05: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
1 changed files with 1 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue