Centralize most of the comment creation/update code in the API.

Review Request #9265 — Created Oct. 12, 2017 and submitted

Information

Review Board
release-3.0.x
bab04c0...

Reviewers

The API's implementations of comment creation/updating for both
top-level comments and replies duplicated a lot of code, which could
easily lead to inconsistencies as we go forward. An upcoming change
required changes in 16 places due to this.

In order to clean this up and keep things maintainable, the existing
create_comment() and update_comment() methods in the base comment
resource have been updated to take more state and return a suitable
payload to the client. A new create_or_update_comment_reply has also
been added to handle the reply side of comment creation. These allow the
subclasses to be responsible only for their own field checking and
object fetching, letting the base class handle all the hard work in a
consistent way.

Documentation has also been fleshed out for these methods.

Unit tests pass.

Description From Last Updated

Can we put one parameter per line?

daviddavid
david
  1. Nice cleanup!

  2. reviewboard/webapi/resources/base_comment.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    Can we put one parameter per line?

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (480d5b5)