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.