Page MenuHomePhabricator

Make configured and EditEngine defaults work correctly for custom fields
ClosedPublic

Authored by epriestley on Dec 17 2015, 5:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 4:12 AM
Unknown Object (File)
Sun, Dec 8, 12:21 PM
Unknown Object (File)
Fri, Dec 6, 10:37 AM
Unknown Object (File)
Fri, Dec 6, 8:29 AM
Unknown Object (File)
Fri, Dec 6, 12:45 AM
Unknown Object (File)
Thu, Dec 5, 5:59 AM
Unknown Object (File)
Tue, Dec 3, 9:16 AM
Unknown Object (File)
Sun, Dec 1, 7:13 AM
Subscribers
None

Details

Summary

Ref T10004. Fixes T5158. There was a long-standing issue with defaults not working properly, but EditEngine has made it more obvious because it's a lot easier to set defaults now.

The issue is basically that the defaults are getting set as the field's real value early on, so when we go to generate the transaction "old value" later, we build a transaction that uses the new value as both the "new value" and "old value". Then the engine says "you didn't change anything, so I'm going to ignore this" and drops it.

To fix this, return null as the "old value" by default, and add a call to overwrite that after we load a legitimate old value.

This fix is a touch iffy, but I have some grand plans to clean up the CustomField stuff more broadly later on.

Test Plan
  • Set config defaults on select/typeahead fields, created and edited tasks.
  • Set form defaults on select/typehaead fields, created and edited tasks.
  • In all cases, transactions and state accurately reflected edits.
  • Set defaults on hidden fields, verified forms respected them correctly.
  • This does generate some fluffy transactions, but I'll deal with those in T7661.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Make configured and EditEngine defaults work correctly for custom fields.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Dec 17 2015, 6:27 PM
This revision was automatically updated to reflect the committed changes.