Split up the reply template tags and add unit tests.

Review Request #9181 — Created Sept. 7, 2017 and submitted

Information

Review Board
release-3.0.x
7ad876a...

Reviewers

The template tag for generating the HTML for replies tried to do a bit
too much, and was not very efficient. It generated replies for the
review body top/bottom fields and for all types of comments, and because
of this mixture it required a lot of state to be passed in. It then
concatenated to a string for every reply, which is not particularly
efficient in Python.

This has been split into two template tags: One for replies to the body
fields of a review, and another to comments. Each only needs to take in
the parameters that are necessary for the type of reply, simplifying
things greatly. It also more efficiently builds the strings,
future-proofs the resulting HTML by explicitly marking as safe, and
transfers some responsibilities to the reply retrieval functions being
called.

There was also a template context push/pop bug in the old code, where we
pushed and then did an update() (implying a push()), and then only
popped once. This caused variables to remain in the context that
shouldn't have been there. It hasn't caused any problems until now, but
it was noticed during development of another change. That bug has been
eliminated.

Unit tests were added for both template tags.

Unit tests pass.

Tested that replies to body top and bottom, general comments, diff
comments, file attachment comments, and screenshot comments all work.

Tested that draft comments show up, and only for the person who made them.

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (20676cc)
Loading...