Consolidate and fix building of RB.FileAttachment model attributes.

Review Request #10914 — Created Feb. 24, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

We build attributes to pass to RB.FileAttachment when building the
page model data (in {% reviewable_page_model_data %}) and when
rendering the change description for any changed file attachments.
This code was duplicated. The former used Python to generate the data.
The latter used a template (and had a typo, resulting in a bad
filename).

This change consolidates this by adding a method to
FileAttachmentsField that returns a dictionary of attribute data. Both
the page model data and the change description rendering make use of
this, ensuring we have a single place to make changes.

This also speeds up rendering of change descriptions by simplifying that
template and avoiding all the extra jsescape calls.

Unit tests passed.

Manually tested pages with file attachments and change descriptions.

Commits

Files

    Loading...