fix: Prevent overriding the ring with empty value
Apparently changing it to an enum field introduced a bug when an empty value from revision would overwrite actual value from the item itself.
This commit is contained in:
@@ -113,7 +113,7 @@ const addRevisionToItem = (item = {
|
|||||||
body: '',
|
body: '',
|
||||||
info: '',
|
info: '',
|
||||||
}, revision) => {
|
}, revision) => {
|
||||||
let newItem = Object.assign(Object.assign(Object.assign({}, item), revision), { body: ignoreEmptyRevisionBody(revision, item) });
|
let newItem = Object.assign(Object.assign(Object.assign({}, item), revision), { ring: revision.ring ? revision.ring : item.ring, body: ignoreEmptyRevisionBody(revision, item) });
|
||||||
if (revisionCreatesNewHistoryEntry(revision)) {
|
if (revisionCreatesNewHistoryEntry(revision)) {
|
||||||
newItem = Object.assign(Object.assign({}, newItem), { revisions: [revision, ...newItem.revisions] });
|
newItem = Object.assign(Object.assign({}, newItem), { revisions: [revision, ...newItem.revisions] });
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -141,6 +141,7 @@ const addRevisionToItem = (
|
|||||||
let newItem: Item = {
|
let newItem: Item = {
|
||||||
...item,
|
...item,
|
||||||
...revision,
|
...revision,
|
||||||
|
ring: revision.ring ? revision.ring : item.ring, // prevent empty revision ring overriding the one from the item. This one field is special as it's an enum.
|
||||||
body: ignoreEmptyRevisionBody(revision, item),
|
body: ignoreEmptyRevisionBody(revision, item),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user