- Status:
- Discarded
Add confirmation dialog for post-commit review requests on web UI
Review Request #10148 — Created Sept. 17, 2018 and submitted
When a user is scrolling through the changeset (post commit review) to
make a new review request on the web UI, clicking on the row of a
commit makes a new review request, which can be done accidentally very
easily.I added a confirmation dialog when creating post-commit review requests
on web UI so the user can confirm that they want to create a new review
request from that commit. Clicking 'cancel' closes the dialog and takes
no further action, clicking 'create' creates a new review request.
Ran JS tests (all of which pass).
Tested behaviour in Chrome, Safari, and Firefox with the following
scenarios:
- Click on commit, click cancel on confirmation dialog
- Click on commit with no diff with master, click confirm, see error
message- Click on commit with diff with master, click confirm, see review
request created
Description | From | Last Updated |
---|---|---|
Can you wrap your summary at 72 characters, but ideally 52 characters. Commit summaries needn't end in a period. |
brennie | |
You can have your testing done render a list using: Tested behaviour in Chrome, Safari in Firefox: 1. Something 2. … |
brennie | |
The issue was originally filed against reviewboard 2.5.x. Can you apply your patch on that branch, test, and re-post? Note: … |
brennie | |
Could you add a screen shot of your work? |
brennie | |
Can you wrap your description at 72 characters? |
brennie | |
One more request to add to the design of this: can we include the commit summary in the text of … |
david | |
Tiny nit: summaries don't need a period. |
brennie | |
Also your summary should be in the imperitive mood as if it were an order. If you substitute your sumamry … |
brennie | |
Ideally this long message would be in the body of the dialog instead of the title |
brennie | |
How about: "The confirmation dialog will allow the user to cancel the creation of the review request." |
brennie | |
We may want to add more context to the message here, something like: You are creating a new review request … |
brennie | |
This string needs to be marked for translation with gettext(). |
brennie | |
This string needs to be marked for translation with gettext(). Missing trailing comma. |
brennie | |
This string needs to be marked for translation with gettext(). |
brennie | |
Unfortunately, we can't use ES6 arrow functions here. We'll have to do _.bind(this._createNewReviewRequest, this) instead. This is because we have … |
brennie | |
Instead of doing this, lets define a subclass that will display this content. We can refactor it out into a … |
brennie | |
Can you add body and title here? The title should be something like "Are you sure?" or "Create review request?" |
brennie | |
This should really be in the default impl of render above. Also, doing _.result twice may result in us calling … |
brennie | |
Title case: Create Review Request? |
brennie | |
While you're here, would you mind updating the doc comment to take the following format: /** * Initialze the view. … |
brennie | |
Need a var body statement at the top of the function. |
brennie | |
if (body) { |
brennie | |
Instead of duplicating this I would just do See the :js:class:`class-level documentation <RB.DialogView>` for the keys that this object accepts. |
brennie | |
Let's sort these alphabetically. |
david | |
Please put a blank line between these two. |
david | |
Instead of <b>, let's just use <span> and then put font-weight: bold in the CSS. |
david | |
Because this is an ES5 file, no trailing comma on the last item in an object. |
david | |
Because this is an ES5 file, no trailing comma on the last item in an object. |
david | |
A few things here. Wrapping everything in gettext wont work. gettext() requires the value to a be a string literal, … |
brennie | |
While you're here, can you change this to /**? Otherwise it doesn't get picked up by the documentation generation tool |
brennie | |
And this? |
brennie | |
This is only used once, so instead of defining a variable, you could do it inline: body: this._dialogBodyTemplate({ prefixText: gettext('...'), … |
david | |
In ES5, all variables need to be defined at the top of the function. So: var commitID = this.model.get('id'), dialogView; … |
david | |
Wrap to 79 columns. |
david |
- Status:
- Discarded
- Change Summary:
-
When I did the rbt post command I didn't realize that I should pass in the branch name as an argument and changing it in the Branch section under Information did not update the diff (it was trying to compare it against master instead of release-4.0.x). After closing and reopening it for review the diff was deleted entirely so I will make a new review request. Sorry!
- Status:
- Re-opened
- Summary:
-
Add confirmation dialog when creating post-commit review requests via the web UIAdded confirmation dialog when creating post-commit review requests on web UI.
- Commit:
-
8de093f73469580eb61d5d294050a0c3df9f3a0a
Checks run (2 succeeded)
-
-
Can you wrap your summary at 72 characters, but ideally 52 characters. Commit summaries needn't end in a period.
-
You can have your testing done render a list using:
Tested behaviour in Chrome, Safari in Firefox: 1. Something 2. Another thing 3. Yet another thing.
-
The issue was originally filed against reviewboard 2.5.x.
Can you apply your patch on that branch, test, and re-post?
Note:
To get Reviewboard 2.5.x to work, you will need a new virtual environment with Review Board at
release-2.5.x
and Djblets atrelease-0.9.x
. You do not need another source checkout of RB or Djblets -- another virtualenv will suffice. -
-
-
How about:
"The confirmation dialog will allow the user to cancel the creation of the review request."
-
We may want to add more context to the message here, something like:
You are creating a new review request from a commit that has already been published. Are you sure you want to continue?
-
-
-
-
Unfortunately, we can't use ES6 arrow functions here. We'll have to do
_.bind(this._createNewReviewRequest, this)
instead.This is because we have customers on older versions of IE (I know :( ). We do allow arrow functions in
.es6.js
files, which are transpiled with Babel to ES5 that can run on all these browsers.However, since this patch will be backported to 2.5.x, we don't be able to use that. Sorry.
- Summary:
-
Added confirmation dialog when creating post-commit review requests on web UI.Confirmation dialog for post-commit review requests on web UI.
- Description:
-
~ When a user is scrolling through the changeset (post commit review) to make a new review request on the web UI, clicking on the row of a commit makes a new review request, which can be done accidentally very easily.
~ When a user is scrolling through the changeset (post
+ commit review) to make a new review request on the + web UI, clicking on the row of a commit makes a new + review request, which can be done accidentally very + easily. ~ I added a confirmation dialog when creating post-commit review requests on web UI so the user can confirm that they want to create a new review request from that commit. Clicking 'cancel' closes the dialog and takes no further action, clicking 'create' creates a new review request.
~ I added a confirmation dialog when creating post-
+ commit review requests on web UI so the user can + confirm that they want to create a new review request + from that commit. Clicking 'cancel' closes the dialog + and takes no further action, clicking 'create' creates + a new review request. - Testing Done:
-
~ Ran JS tests (all of which pass except the 6 that are broken in the release-4.0.x branch).
~ Ran JS tests (all of which pass except the 6 that are
+ broken in the release-4.0.x branch). ~ Tested behaviour in Chrome, Safari, and Firefox with the following scenarios:
~ 1) Click on commit, click cancel on confirmation dialog ~ 2) Click on commit with no diff with master, click confirm, see error message ~ 3) Click on commit with diff with master, click confirm, see review request created ~ Tested behaviour in Chrome, Safari, and Firefox with
~ the following scenarios: ~ ~ - Click on commit, click cancel on confirmation dialog
+ - Click on commit with no diff with master, click
confirm, see error message
+ - Click on commit with diff with master, click confirm,
see review request created
- Branch:
-
release-4.0.xrelease-2.5.x
- Commit:
-
8de093f73469580eb61d5d294050a0c3df9f3a0a0c5bb0bae06b55592e9657f190fa02892375fd4f
- Added Files:
Checks run (2 succeeded)
- Testing Done:
-
~ Ran JS tests (all of which pass except the 6 that are
~ Ran JS tests (all of which pass).
- broken in the release-4.0.x branch). Tested behaviour in Chrome, Safari, and Firefox with
the following scenarios: - Click on commit, click cancel on confirmation dialog
- Click on commit with no diff with master, click
confirm, see error message
- Click on commit with diff with master, click confirm,
see review request created
- Description:
-
~ When a user is scrolling through the changeset (post
~ commit review) to make a new review request on the ~ web UI, clicking on the row of a commit makes a new ~ When a user is scrolling through the changeset (post commit review) to
~ make a new review request on the web UI, clicking on the row of a ~ commit makes a new review request, which can be done accidentally very - review request, which can be done accidentally very easily. ~ I added a confirmation dialog when creating post-
~ commit review requests on web UI so the user can ~ confirm that they want to create a new review request ~ from that commit. Clicking 'cancel' closes the dialog ~ I added a confirmation dialog when creating post-commit review requests
~ on web UI so the user can confirm that they want to create a new review ~ request from that commit. Clicking 'cancel' closes the dialog and takes ~ no further action, clicking 'create' creates a new review request. - and takes no further action, clicking 'create' creates - a new review request. - Testing Done:
-
Ran JS tests (all of which pass).
~ Tested behaviour in Chrome, Safari, and Firefox with
~ the following scenarios: ~ Tested behaviour in Chrome, Safari, and Firefox with the following
~ scenarios: - Click on commit, click cancel on confirmation dialog
~ - Click on commit with no diff with master, click
confirm, see error message
~ - Click on commit with diff with master, click confirm,
see review request created
~ - Click on commit with no diff with master, click confirm, see error
message
~ - Click on commit with diff with master, click confirm, see review
request created
-
-
-
Instead of doing this, lets define a subclass that will display this content. We can refactor it out into a generic class at a later date.
If you wrap the contents of the file in an IIFE, we can have it local to the file.
- Commit:
-
0c5bb0bae06b55592e9657f190fa02892375fd4fdca1db96038f3212cc85c19a5bfb72027cccbb9f
- Diff:
-
Revision 3 (+38 -2)
- Removed Files:
- Added Files:
Checks run (2 succeeded)
-
-
Can you add body and title here?
The title should be something like "Are you sure?" or "Create review request?"
-
This should really be in the default impl of render above. Also, doing
_.result
twice may result in us calling an expensive function twice. Lets do:var body; /* snip */ body = _.result(this, 'body'); if (body !== undefined) { this.$el.append($('<p>').text(body)); }
- Commit:
-
dca1db96038f3212cc85c19a5bfb72027cccbb9fb64eee51c377599f5ebdd6891d3231fe936b70ac
Checks run (2 succeeded)
-
-
-
While you're here, would you mind updating the doc comment to take the following format:
/** * Initialze the view. * * Args: * options (object): * Options for the view. * * Option Args: * body (string or function, optional): * <Description of body.> * * title (string, optional): * <Description of title.> * * buttons (object, optional): * <Description of buttons.> */
-
-
- Commit:
-
b64eee51c377599f5ebdd6891d3231fe936b70acec90b6774be98dd40d63568fb9c2f2ab49440064
- Diff:
-
Revision 5 (+64 -6)
- Added Files:
Checks run (2 succeeded)
- Commit:
-
ec90b6774be98dd40d63568fb9c2f2ab4944006467473ac69b08ccb686eb9f90d9efb26b8e2ac86f
Checks run (2 succeeded)
- Commit:
-
67473ac69b08ccb686eb9f90d9efb26b8e2ac86f23df101ff76cf28b8bf302b8a739e4dddd7f3074
Checks run (2 succeeded)
- Commit:
-
23df101ff76cf28b8bf302b8a739e4dddd7f30741ba7bcd2d2853d0701b6ca922ac2f8344ce752bf
Checks run (2 succeeded)
-
-
A few things here. Wrapping everything in gettext wont work.
gettext()
requires the value to a be a string literal, otherwise the code that looks for things to translate won't be able to parse this.Also, we want to avoid using inline styles when possible. This should be included in the rules for
.summary
in the LESS file.Instead, lets use a template on the class:
{ _dialogTemplate: _.template([ '<p><%- prefixText %></p>', '<p class="summary">', ' <%- commitID %>: <%- summary %>', '</p>', '<p><%- suffixText %></p>', ].join('')), }
For more details on
_.template
, check out the docs.Then we can use it like so:
var dialogView = new RB.DialogView({ title: gettext('Create Review Request?'), body: this._dialogTemplate({ prefixText: gettext('You are creating a new review request from the following published commit:'), suffixText: gettext('Are you sure you want to continue?'), }), buttons: [ /* ... */ ] });
This allows us to only mark the string literals for translation. Additionally, lets use
<p>
tags for content separation instead of<br>
, as that is what they exist for.
- Commit:
-
1ba7bcd2d2853d0701b6ca922ac2f8344ce752bf885d8bf2435698a6502a89e0f9fa405227f89e50
Checks run (2 succeeded)
- Summary:
-
Confirmation dialog for post-commit review requests on web UI.Add confirmation dialog for post-commit review requests on web UI
- Commit:
-
885d8bf2435698a6502a89e0f9fa405227f89e509b4fa2e9af5510cbf4f61787c668c8cad2819230
Checks run (2 succeeded)
-
-
This is only used once, so instead of defining a variable, you could do it inline:
body: this._dialogBodyTemplate({ prefixText: gettext('...'), commitID: commitID, summary: this.model.get('summary'), suffixText: ... }),
-
In ES5, all variables need to be defined at the top of the function. So:
var commitID = this.model.get('id'), dialogView; if (commitID.length > 7) { commitID = commitID.slice(0, 7); } dialogView = new RB.DialogView({ ...
-