Improve the model and capabilities for rich text in the API.

Review Request #5127 — Created Dec. 16, 2013 and submitted

Information

Review Board
master

Reviewers

Improve the model and capabilities for rich text in the API.

This updates the rich text support in the API to allow clients to force
text to be of a specific type. There's now a ?force-text-type= query
parameter that will cause all Markdown-aware fields to be formatted in
the requested way. If passing "plain", then any Markdown escaping will be
unescaped before being returned, and if "markdown", then any plain text
will be escaped.

This can later be expanded. For example, we may add "html" to do the
rendering server-side, further reducing the burden on the client.

In order to be consistent, this also replaces the rich_text field in
request and response paylods with text_type. For response payloads,
this will show "markdown" or "plain" (instead of True/False), or will
show the forced text mode (if/when a different mode is supported). For
requests, it will accept only "markdown" or "plain".

This is the first half of the change. The second half moves the
JavaScript codebase and templates to make use of the new API changes.

(NOTE: The current build of Review Board on this server has a breakage
causing base_comment.py to fail to render. The rest is reviewable.)

Unit tests pass.

Performed some requests, forcing Markdown text to plain, and plain to
Markdown.

In the case of Markdown-to-plain, any escaped content became unescaped.

For plain-to-Markdown, Markdown-unsafe characters became escaped.

Markdown-to-Markdown and plain-to-plain stayed as-is.

Description From Last Updated

Alignment is off here.

daviddavid

Let's make this a unit test assert and not a language assert.

daviddavid

Here too.

daviddavid

Here too.

daviddavid

Here too.

daviddavid

And finally here.

daviddavid
david
  1. 
      
  2. Show all issues

    Alignment is off here.

  3. Show all issues

    Let's make this a unit test assert and not a language assert.

    1. Can do. I went with assert because this is a failure of the test suite and not the result of something from the new code, but I guess it's not a problem to use the unit test ones.

  4. Show all issues

    Here too.

  5. Show all issues

    Here too.

  6. Show all issues

    Here too.

  7. Show all issues

    And finally here.

  8. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed