Fix rich text defaults when loading newly-saved comments.

Review Request #7606 — Created Aug. 23, 2015 and submitted — Latest diff uploaded

Information

Review Board
release-2.0.x

Reviewers

When saving a comment in the diff viewer and turning off rich text
(while having the "Always use Markdown by default" option checked), the
comment state would appear incorrect. The Markdown checkbox would be
unchecked, and the text would style the intended plain text as Markdown.
Both were clearly wrong.

The comment dialog and underlying editor model now follow the behavior
of the other editors in the UI. If the user's default is to use rich
text, then any loaded comment will be set for rich text editing (escaped
if needed and with the Markdown checkbox checked). If the default is to
use the comment's original mode, then the editor will fully reflect that
mode.

Unit tests pass.

Tested the following conditions manually, both with and without "Always
use Markdown for text fields" set, and in both diffs and file attachments:

  • Created a plain text comment, and verified its state when immediately
    loading after save.
  • Created a rich text comment, and verified its state when immediately
    loading after save.
  • Viewed exising plain text comment, and verified its state.
  • Viewed existing rich text comment, and verified its state.
  • Viewed tooltips for both plain text and rich text comments.

This was also tested on both Review Board 2.0 and 2.5.