• 
      

    Move the comment models to Backbone.js.

    Review Request #3834 — Created Feb. 3, 2013 and submitted

    Information

    Review Board
    master

    Reviewers

    Move the comment models to Backbone.js.
    
    Previously, each comment implementation, though similar in
    functionality, had lots of duplicate code.
    
    Now there's a BaseComment model that takes care of all core comment
    functionality, and subclasses that implement the support for the
    specialized attributes they care about.
    
    These objects validate their data when setting and before sending to the
    server, to help us catch otherwise non-obvious problems. This is a
    pattern I hope to make use of going forward, so that we can provide more
    clear errors when we hit bugs.
    
    All the other commenting code (blocks, dialogs) that deal with the
    Comment objects had to be updated to make use of the newer-style
    properties and events.
    
    Unit tests were added to test the various bits of functionality.
    All unit tests pass.
    
    I tested the following with diff comments, screenshot comments, and
    file attachment comments:
    
    1) Creating new comments works (tested with and without existing drafts)
    2) Editing an existing draft comment works.
    3) Deleting a draft comment works.
    4) Comments publish correctly.
    5) The comment dialog dirty state behaves as expected in response to
       the presence of text in the field, and modifications to that text.
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/settings.py
        Ignored Files:
          reviewboard/static/rb/js/views/abstractCommentBlockView.js
          reviewboard/static/rb/js/models/baseCommentModel.js
          reviewboard/static/rb/js/models/screenshotCommentModel.js
          reviewboard/static/rb/js/models/tests/diffCommentModelTests.js
          reviewboard/static/rb/js/models/fileAttachmentCommentModel.js
          reviewboard/static/rb/js/datastore.js
          reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
          reviewboard/static/rb/js/models/abstractCommentBlockModel.js
          reviewboard/static/rb/js/models/fileAttachmentCommentBlockModel.js
          reviewboard/static/rb/js/models/tests/fileAttachmentCommentModelTests.js
          reviewboard/static/rb/js/models/diffCommentModel.js
          reviewboard/static/rb/js/models/tests/baseCommentModelTests.js
          reviewboard/static/rb/js/diffviewer.js
          reviewboard/static/rb/js/models/tests/screenshotCommentModelTests.js
          reviewboard/static/rb/js/views/commentDialogView.js
          reviewboard/static/rb/js/models/commentEditorModel.js
          reviewboard/static/rb/js/models/abstractCommentModel.js
          reviewboard/static/rb/js/reviews.js
      
      
    2. 
        
    david
    1. I didn't dig into the test cases, but the code looks good.
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (ce6d542cfafd871aedaae4545469e8e9a488ea0b)