Fix text/rich text loading, rendering, and storage for custom fields.
Review Request #10103 — Created July 27, 2018 and submitted
The rewrite of custom fields on the JavaScript side broke several
aspects of text-based fields, causing rendering glitches and bad data
stored in extra_data. The following issues were found:
The registered field ID was often being used instead of the JSON
field name, preventing some fields from being looked up in any
payloads.Similarly, a
<fieldID>RichText
boolean was being looked up (and
saved) for custom fields, instead of using the
<json_field_id>_text_type
value.These values were always being pulled out of extra_data, which
resulted in corrupted displays, as we were requesting HTML renders of
the values.raw_text_fields
should have been used instead.The new dirty handling wasn't noticing changes to the Enable Markdown
checkbox, due to race conditions in calculation.Fields now have mandatory
jsonFieldName
andjsonTextTypeFieldName
(for text fields) attributes, which are guaranteed to be set. These are
used or provided wherever we may be working withextra_data
or
raw_text_fields
.
setDraftField()
andgetDraftField()
now assert for required values.
getDraftField()
also now accepts some options for working with
raw_text_fields
.Value loading for fields has been centralized in a
_loadValue()
function, preventing some copy/paste for non-trivial calls. Same with
loading rich text booleans for text fields.Unit tests have been introduced for custom fields to check all the
various states, preventing regressions in the future.
All unit tests pass.
Tested loading and saving both plain text and Markdown text for
all forms of built-in text fields (Close Description, Draft Change
Description, Description, Testing Done) and custom text fields.
Ensured that initial loads of both text types work, that saving
works, and that saving twice in one page session works.
Description | From | Last Updated |
---|---|---|
Col: 25 'draft' is defined but never used. |
reviewbot | |
Col: 41 Missing semicolon. |
reviewbot | |
Col: 41 Missing semicolon. |
reviewbot | |
Col: 41 Missing semicolon. |
reviewbot | |
Col: 39 Unnecessary semicolon. |
reviewbot | |
Col: 21 Do not use 'new' for side effects. |
reviewbot | |
This looks like it can be const instead of let |
david |
- Change Summary:
-
Fixed Review Bot complaints.
- Commit:
-
587268329848bae1a2e07d4e42f66d9259e9d670fa19582e9fef50a868f4bc16df8bae3d67cf16b7
- Diff:
-
Revision 2 (+596 -41)
Checks run (2 succeeded)
- Change Summary:
-
Changed a
let
to aconst
. - Commit:
-
fa19582e9fef50a868f4bc16df8bae3d67cf16b7074a770b5472298048d8b8d1fbc08ddcc1449dd7
- Diff:
-
Revision 3 (+596 -41)