Centralize most of the comment creation/update code in the API.
Review Request #9265 — Created Oct. 12, 2017 and submitted
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()
andupdate_comment()
methods in the base comment
resource have been updated to take more state and return a suitable
payload to the client. A newcreate_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? |
david |
- Change Summary:
-
Changed
create_comment
to have one parameter per line. - Commit:
-
08a75f8f236a194edf94c9b3dbc3c7ea19fdd0acbab04c01c17e8266a559180931095952b01f73db
- Diff:
-
Revision 2 (+273 -240)