Homec4science

Make configured and EditEngine defaults work correctly for custom fields

Authored by epriestley <git@epriestley.com> on Dec 17 2015, 18:01.

Description

Make configured and EditEngine defaults work correctly for custom fields

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.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T5158, T10004

Differential Revision: https://secure.phabricator.com/D14809

Details

Committed
epriestley <git@epriestley.com>Dec 17 2015, 19:44
Pushed
aubortJan 31 2017, 17:16
Parents
rPH38e31375eac6: Improve UX for customizing EditEngine forms a little bit
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH8a0dfa94d438: Make configured and EditEngine defaults work correctly for custom fields (authored by epriestley <git@epriestley.com>).Dec 17 2015, 19:44