Clean up dirty tracking for integration fields
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Follow-up from !81813 (comment 912180070):
🤔 Unrelated to your MR, but it looks like nothing ever resets@old_data_fields
in our code, even after commit.
- Changes to
properties
are tracked via@updated_properties
- Changes to
data_fields
are tracked via@old_data_fields
- When saving the integration record, we only reset
@updated_properties
via theafter_commit
hook at https://gitlab.com/gitlab-org/gitlab/blob/eb83f947442c090b3c66dec0c59602e6a6561eec/app/models/integration.rb#L90 - A consequence of this is that e.g.
#{field}_changed?
still returnstrue
after saving for data fields, butfalse
for properties. - This doesn't seem to cause any bugs (AFAIK), so this would be just a clean-up.
Improvements
We could clear @old_data_fields
too in reset_updated_properties
, but should probably rename the method for clarity (reset_updated_fields
?).
Maybe we could even use the same instance variable for both properties and data fields, since we shouldn't really use both at the same time anyway.
Edited by 🤖 GitLab Bot 🤖