Fix rich text defaults when loading newly-saved comments.
Review Request #7606 — Created Aug. 23, 2015 and submitted
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.
- Change Summary:
-
Updated the comment for
extraQueryArgs
mentioning that the values can be overridden. - Diff:
-
Revision 2 (+267 -41)
-
Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/tests/commentDialogViewTests.js reviewboard/static/rb/js/models/tests/commentEditorModelTests.js reviewboard/static/rb/js/models/abstractCommentBlockModel.js reviewboard/static/rb/js/resources/models/draftResourceModelMixin.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/models/baseCommentModel.js reviewboard/static/rb/js/views/commentDialogView.js reviewboard/static/rb/js/models/commentEditorModel.js Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/tests/commentDialogViewTests.js reviewboard/static/rb/js/models/tests/commentEditorModelTests.js reviewboard/static/rb/js/models/abstractCommentBlockModel.js reviewboard/static/rb/js/resources/models/draftResourceModelMixin.js reviewboard/static/rb/js/resources/models/baseResourceModel.js reviewboard/static/rb/js/resources/models/baseCommentModel.js reviewboard/static/rb/js/views/commentDialogView.js reviewboard/static/rb/js/models/commentEditorModel.js