• 
      

    Allow commenting on draft (unpublished) items.

    Review Request #12949 — Created April 12, 2023 and submitted

    Information

    Review Board
    release-6.x

    Reviewers

    For as long as Review Board has existed, we've disallowed commenting on
    items before they're published. The reasoning here was that if you add a
    diff comment, replacing the diff will delete the comment (and similar
    for file attachments).

    This change updates the comment dialog to remove the hasDraft checks.
    This is replaced with a new mechanism whereby we add a public state to
    diffs and file attachments, and use that to show a warning to the user
    if they're commenting on something which has not yet been published. The
    bulk of the code changes here are just plumbing that state all the way
    down to the comment block models, which use it to decide what to display
    to the user.

    • Ran unit tests.
    • Created review requests with published and unpublished diffs and file
      attachments. Checked that adding a comment to published items worked
      as normal, and that the draft warnings were correctly shown for draft
      diffs and file attachments, as well as for interdiffs and file
      attachment diffs involving an unpublished tip revision.
    Summary ID
    Allow commenting on draft (unpublished) items.
    For as long as Review Board has existed, we've disallowed commenting on items before they're published. The reasoning here was that if you add a diff comment, replacing the diff will delete the comment (and similar for file attachments). This change updates the comment dialog to remove the `hasDraft` checks. This is replaced with a new mechanism whereby we add a `public` state to diffs and file attachments, and use that to show a warning to the user if they're commenting on something which has not yet been published. The bulk of the code changes here are just plumbing that state all the way down to the comment block models, which use it to decide what to display to the user. Testing Done: - Ran unit tests. - Created review requests with published and unpublished diffs and file attachments. Checked that adding a comment to published items worked as normal, and that the draft warnings were correctly shown for draft diffs and file attachments, as well as for interdiffs and file attachment diffs involving an unpublished tip revision.
    5ae837284a1299d99ebcb65ecd4757837c8de21e
    Description From Last Updated

    Do comments get deleted when the draft diff/file is replaced? I think we should update the unit tests to confirm …

    maubinmaubin

    line too long (80 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    If comments get deleted when a draft diff is replaced, I think we should explicitely say delete here instead of …

    maubinmaubin

    If comments get deleted when the file is replaced, I think we should explicitely say delete here instead of invalidate.

    maubinmaubin
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    maubin
    1. 
        
    2. Show all issues

      Do comments get deleted when the draft diff/file is replaced? I think we should update the unit tests to confirm what happens after draft diffs/files get deleted while they have comments.

    3. Show all issues

      If comments get deleted when a draft diff is replaced, I think we should explicitely say delete here instead of invalidate.

    4. Show all issues

      If comments get deleted when the file is replaced, I think we should explicitely say delete here instead of invalidate.

    5. 
        
    david
    maubin
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-6.x (cb8c50c)