Cleanup line content html attributes
When we're showing diffs, where notes are allowed we're setting a lot of data in HTML nodes, most of it is repeated along the lines of the same diff file.
What data we need:
- noteable_type (merge_request)
- noteable_id (id of the merge request)
- diff_refs (start_commit, head_commit, base_commit)
- note_type (DiffNote, LegacyDiffNote) . line_code (depends on the line numbers and the file path)
So I think we should add the data attributes at their level and then compound what we need asking each level for the data that belongs to it to generate what we need to create notes (all of this using JavaScript).
- diff level
- noteable_type
- noteable_id
- diff_refs
- note_type
- diff_file level
- file_path (new and old if needed)
- line level
- old and new line numbers
That change can reduce the size of the diff pages a lot
Ideas in how to start split this cleanup
- Remove data-linenumber -> modifies
LineHighlighter
and unfolding logic onDiff
component
We can get the information from the line-holder#id
element. if the line-holder has new/old classes that's indicate we have a linenumber in their id
- 1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1 -> hexdigest_#{old line_number}_#{new line_number}