Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forget that attribute is modified if it's changed back to its original state via API #8036

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions lib/base/configobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,32 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
original_attributes->Set(key, Empty);
}
}
} else if (!original_attributes->Contains(attr))
original_attributes->Set(attr, oldValue);
} else {
Value originalAttribute;

if (original_attributes->Get(attr, &originalAttribute)) {
if (JsonEncode(value) == JsonEncode(originalAttribute)) {
original_attributes->Remove(attr);
}
} else {
original_attributes->Set(attr, oldValue);
}
}
}

dict->Set(key, value);
} else {
newValue = value;

if (field.Attributes & FAConfig) {
if (!original_attributes->Contains(attr)) {
Value originalAttribute;

if (original_attributes->Get(attr, &originalAttribute)) {
if (JsonEncode(value) == JsonEncode(originalAttribute)) {
updated_original_attributes = true;
original_attributes->Remove(attr);
}
} else {
updated_original_attributes = true;
original_attributes->Set(attr, oldValue);
}
Expand Down