|
| 1 | +**_Part 1 - Required information_** |
| 2 | + |
| 3 | +# Pull Request Review -- Reviewer Flow |
| 4 | + |
| 5 | +## :memo: Summary |
| 6 | + |
| 7 | +Provide code review to an existing pull request within Atom. |
| 8 | + |
| 9 | +*Note*: This RFC is an iteration of the [original RFC for Pull Request Review](./003-pull-request-review.md). |
| 10 | + |
| 11 | +## :checkered_flag: Motivation |
| 12 | + |
| 13 | +We already have an innovative review-comments-in-dock (RCID) workflow built out for the receiving end of pull request reviews. In order to complete the full code review experience within Atom, we should also build out a workflow for users to author pull request reviews. |
| 14 | + |
| 15 | +## 🤯 Workflow Explanation |
| 16 | + |
| 17 | +This is a high level overview of what the workflow of a PR Review author should look like. More on the functionality and behaviour of each component in the next section. |
| 18 | + |
| 19 | +#### 1. Start a review |
| 20 | + |
| 21 | +There are three ways to start a review: |
| 22 | +1. Click "Start a review" button on the header of review dock, or footer of PR detail item, or on the empty state of review dock |
| 23 | +2. [Respond to an existing review thread by clicking "Start a review"](#responding-to-a-comment-thread) |
| 24 | +3. [Click on a "add comment" icon on the gutter](#add-comment-gutter-icon) |
| 25 | + |
| 26 | +#### 2. Continue a review |
| 27 | + |
| 28 | +Once a pending review has been started, user can add more comments to it by: |
| 29 | +1. [Responding to an existing review thread](#responding-to-a-comment-thread) |
| 30 | +2. [Clicking "add comment" icon on the gutter](#add-comment-gutter-icon) |
| 31 | + |
| 32 | +#### 3. Submit a review |
| 33 | +The only way to submit a review within Atom is by using the ["Submit review" button in the Pending Review tab](#summary-section). After publishing the review, the Pending Review tab will be destroyed. User will be led back to the All Reviews tab, which will immediately reflect the just published review. |
| 34 | + |
| 35 | +## 🤯 Components Explanation |
| 36 | + |
| 37 | + |
| 38 | +### "All Reviews" tab |
| 39 | +This tab shows all review summaries and review comments, including the ones that are part of a _pending review_ that has not been submitted yet. |
| 40 | + |
| 41 | +#### Header tabs |
| 42 | +| header with no pending review | header with pending review | |
| 43 | +|---|---| |
| 44 | +|<img width="380" alt="new header" src="https://user-images.githubusercontent.com/6842965/57045364-57989b00-6c3b-11e9-8e95-309a17441d98.png">|<img width="380" alt="new header" src="https://user-images.githubusercontent.com/6842965/57045356-54051400-6c3b-11e9-8918-1ba043163c4d.png">| |
| 45 | + |
| 46 | +- When there is no pending review, button reads "Start a new review", clicking on which will take you to the Pending Review tab in its empty state. |
| 47 | +- When there is already a pending review, the button is replaced by a regular tab that reads "Pending Review (2)". The number is a counter of comments currently in the pending review. When adding more pending comments _within the All Reviews tab_ (more on that flow below), there should be some emphasis on the counter changing -- akin to the button on dotcom. |
| 48 | + |
| 49 | +#### Responding to a comment thread |
| 50 | + |
| 51 | + |
| 52 | +User can respond to a comment thread by adding a single line comment (current implementation) or starting a new review. The two buttons should only show up when the comment textbox is in focus, or is _not_ empty. |
| 53 | + |
| 54 | +When there is already an existing pending review, there should only be **one** `btn-primary` button that reads "Comment". |
| 55 | + |
| 56 | +#### Pending comments |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +Pending comments within the All Reviews tab are styled differently from the already published comments. Pending comments contain a badge, and when clicked, will take user to the Pending Review tab. |
| 61 | + |
| 62 | + |
| 63 | +### "Pending Review" tab |
| 64 | +This tab shows *a subset* of all reviews -- only the summary and comments of a pending review. Since a user is only allowed to have one pending review at a time, there should also only be maximum one Pending Review tab. |
| 65 | + |
| 66 | +#### Header (or the alternate footer) |
| 67 | +The header looks very similar to the one of All Reviews tab, with the exception that the primary button now reads "See all reviews", and will send users back to the All Reviews tab. |
| 68 | + |
| 69 | + |
| 70 | +#### Summary section |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +The summary section of the Pending Review tab is sticky (although still collapsible), so it stays within view regardless of how long the list of comments below it is. The icon on the left indicates the type of review, which can be selected in the dropdown underneath the text box. The button to submit review will be disabled a review type has not been chosen from the dropdown menu. |
| 75 | + |
| 76 | + |
| 77 | +#### Comments section |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +The comments section of the Pending Review tab looks very similar to that of the All Reviews tab, except that the progress bar is replaced by a small comment counter on top of the whole section. |
| 82 | + |
| 83 | +**Empty State** of this section should contain a graphical tutorial of how to add a comment via gutter icon, along with a way to quickly navigate to the files changed tab so users can start adding comments right away. |
| 84 | + |
| 85 | + |
| 86 | +### New Comment |
| 87 | + |
| 88 | + |
| 89 | +A new comment block can appear in either All Reviews tab or Pending Review tab, depending on the scenarios covered in [the section below](#add-comment-gutter-icon). When in focus, a new comment block always has a glowing border to emphasize itself. If there is already a pending review, there should only be one `btn-primary` button that reads "Comment". |
| 90 | + |
| 91 | + |
| 92 | +### "Add comment" gutter icon |
| 93 | + |
| 94 | +A user can start a review or add a comment to an existing pending review by clicking on the "add comment" icon which shows up on hover over the gutter of `MultiFilePatch` view within Files tab in `PullRequestDetailView`. |
| 95 | + |
| 96 | +The flow of starting a review or adding a comment from the gutter varies a bit depending on the state of reviews: |
| 97 | + |
| 98 | +* If there are no reviews at all |
| 99 | + 1. User clicks on "add comment" icon in gutter |
| 100 | + 2. *Pending Review* tab opens in empty state |
| 101 | + 3. New comment block is added to the Pending Review tab |
| 102 | + |
| 103 | + |
| 104 | +* If there are existing reviews and no pending review |
| 105 | + 1. User clicks on "add comment" icon in gutter |
| 106 | + 2. *All Reviews* tab open |
| 107 | + 3. New comment block is added to the All Reviews tab |
| 108 | + 4. User can choose between "Add a single comment" or "start a review" |
| 109 | + 5. (a) "add single comment": comment is added to the All Reviews tab; (b) "start a review": user is redirected to the pending tab with the newly added pending comment there |
| 110 | + |
| 111 | + |
| 112 | +* If there is a pending review |
| 113 | + 1. User clicks on "add comment" icon in gutter |
| 114 | + 2. *Pending reviews* tab open |
| 115 | + 3. New comment block is added to the Pending Review tab |
| 116 | + |
| 117 | + |
| 118 | +## :anchor: Drawbacks |
| 119 | + |
| 120 | +None considered, since this is a crucial part of a holistic pull request review experience. |
| 121 | + |
| 122 | +## :thinking: Rationale and alternatives |
| 123 | + |
| 124 | +Since we have already decided and implemented review tab to _view_ PR review, it makes sense to extend the tab's functionality to include the capability of authoring a review. |
| 125 | + |
| 126 | +## :warning: Out of Scope |
| 127 | + |
| 128 | +- Allowing review comments to be left in regions _outside of_ the modified region of a PR |
| 129 | +- Adding comments from editor instead of just from files changed tab in `PRDetailView` |
| 130 | + |
| 131 | +## :construction: Implementation phases |
| 132 | + |
| 133 | +An "edit comment" functionality will be needed for this feature. It can be a standalone piece that gets tackled separately, before starting the PR review authoring experience. |
| 134 | + |
| 135 | +## :white_check_mark: Feature description for Atom release blog post |
| 136 | + |
| 137 | +TBD |
0 commit comments