Whew, done. There are 20-odd items that need addressing but most of them
are quite small. Bear in mind that some of these may be addressed in the
next branch, but I thought it better to make note of them now just in
case. I'm marking the branch as r=me as I think all of these can be
addressed fairly simply and I don't want to block the landing. If any
major revisions are made someone else can add their vote beside mine.
One thing that I did notice was that certain things (like the
trailing-comma-before-closing-brace problem, see [6]) should have been
picked up by our JS linter (which I think runs as part of `make lint.`
Could you re-run that for me and, if they're not being picked up, file a
bug?
395 + Bugs can be tagged to help the project categorise the bug report. You
396 + can filter your subscription based on one or more tags. If you can choose
397 + to <em>Match all tags</em> then your filter will only match bugs that
398 + have each of those tags you enter here.
Should the end of line 396 read "If you choose" rather than "If you can
choose..."?
[4]
476 + // The list may be undefined in some cases.
477 + return list && list.indexOf(target) != -1;
(This is a common pattern elsewhere in the LP JS, though I don't know if
it's considered a standard). I'll not bother highlighting the other
cases; they're easy enough to find.
[6]
495 + statuses: [],
496 + };
The comma before the closing brace on an object literal causes problems
with some browsers (Opera and some versions of WebKit, IIRC); it should
be removed.
[7]
569 + on: {failure: overlay_error_handler.getFailureHandler()},
The trailing comma needs to die for the same reason as in [6].
691 + alert('"Subscribe to bug mail" link not found.');
We shouldn't be using the alert() here any more. Y.fail would seem more
appropriate.
[13]
698 + e.preventDefault();
There's a been a bug about the use of e.preventDefault() and
e.stopPropagation() not working properly with some browsers (probably IE
but ISTR some WebKit browsers had problems too). For safety we should
use e.halt(), since in all the cases where one of {preventDefault,
stopPropagation} fails, the other works fine, and e.halt() calls both.
It's probably worth replacing all instances of preventDefault() in this
JS with halt().
[14]
708 +function clear_overlay(content_node) {
This needs documentation.
[15]
902 + * @param node The node to collapse.
903 + */
904 +function collapse_node(node, user_cfg) {
user_cfg needs to be documented here, too.
[16]
939 +/**
940 + * Expand the node and set its arrow to 'collapsed'
941 + * @param node The node to collapse.
942 + */
943 +function expand_node(node, user_cfg) {
Same as [15].
[17]
977 +/**
978 + * Construct the overlay and populate it with the add/edit form.
979 + *
980 + * @method setup_overlay
981 + * @param {String} content_box_id Id of the element on the page where
982 + * the overlay is anchored.
983 + * @return {String} overlay_id Id of the constructed overlay element.
984 + */
985 +function setup_overlay(content_box_id, hide_recipient_picker) {
There's no overlay_id parameter, so you can drop the documentation for
it.
[18]
1242 + // if we want to allow editing of the recipient, do this instead
1243 + // of the if/else block below.
1244 + // set_recipient(
1245 + // content_node, subscriber_is_team, team_link);
Can this be dropped from the code or are we going to be using it later?
The test_extract_* tests in the extract_form_data test case could do
with some documentation too, though I realise there'd be a lot of
boilerplate there. Maybe one comment for the test case would suffice.
[20]
1918 + // When initialized the <div> elements for the filter
1919 + // wrapper and the accordion wrapper should be collapsed.
1920 + // Since the collapsing is done via animation, we must
1921 + // wait a bit for it to happen.
In the comments here you talk about waiting for something to happen, but
I don't see any calls to this.wait() in this test. Can this statement be
removed?
Hi Gary,
Whew, done. There are 20-odd items that need addressing but most of them
are quite small. Bear in mind that some of these may be addressed in the
next branch, but I thought it better to make note of them now just in
case. I'm marking the branch as r=me as I think all of these can be
addressed fairly simply and I don't want to block the landing. If any
major revisions are made someone else can add their vote beside mine.
One thing that I did notice was that certain things (like the comma-before- closing- brace problem, see [6]) should have been
trailing-
picked up by our JS linter (which I think runs as part of `make lint.`
Could you re-run that for me and, if they're not being picked up, file a
bug?
[1]
236 + Y.on('domready', function() { setup_bug_ subscriptions( subscription- content- box"})
237 + module.
238 + {content_box: "#structural-
This line needs a semicolon.
239 + });
And this need to be outdented by four spaces to avoid it looking like
it's closing the above JS Object.
[2]
236 + Y.on('domready', function() { setup_bug_ subscriptions( subscription- content- box"})
237 + module.
238 + {content_box: "#structural-
239 + });
Same comments as [1].
[3]
395 + Bugs can be tagged to help the project categorise the bug report. You
396 + can filter your subscription based on one or more tags. If you can choose
397 + to <em>Match all tags</em> then your filter will only match bugs that
398 + have each of those tags you enter here.
Should the end of line 396 read "If you choose" rather than "If you can
choose..."?
[4]
476 + // The list may be undefined in some cases. target) != -1;
477 + return list && list.indexOf(
We should use isArray() explicitly here:
return Y.Lang. isArray( list) && list.indexOf( target) != -1;
[5]
479 +namespace. list_contains = list_contains;
This seems to be a common pattern. Why not just make the function part
of the namespace in the first place:
namespace. list_contains = function(list, target) {
///...
};
(This is a common pattern elsewhere in the LP JS, though I don't know if
it's considered a standard). I'll not bother highlighting the other
cases; they're easy enough to find.
[6]
495 + statuses: [],
496 + };
The comma before the closing brace on an object literal causes problems
with some browsers (Opera and some versions of WebKit, IIRC); it should
be removed.
[7]
569 + on: {failure: overlay_ error_handler. getFailureHandl er()},
The trailing comma needs to die for the same reason as in [6].
[8]
575 +namespace. _delete_ filter = delete_filter
Needs a semicolon.
[9]
611 +namespace. _add_bug_ filter = add_bug_filter
So does this.
[10]
633 +function edit_subscripti on_handler( context, form_data) {
This function needs some documentation commentary.
[11]
649 +function create_ overlay( content_ box_id, overlay_id, submit_button,
650 + submit_callback) {
As does this one.
[12]
691 + alert('"Subscribe to bug mail" link not found.');
We shouldn't be using the alert() here any more. Y.fail would seem more
appropriate.
[13]
698 + e.preventDefault();
There's a been a bug about the use of e.preventDefault() and
e.stopPropagation() not working properly with some browsers (probably IE
but ISTR some WebKit browsers had problems too). For safety we should
use e.halt(), since in all the cases where one of {preventDefault,
stopPropagation} fails, the other works fine, and e.halt() calls both.
It's probably worth replacing all instances of preventDefault() in this
JS with halt().
[14]
708 +function clear_overlay( content_ node) {
This needs documentation.
[15]
902 + * @param node The node to collapse.
903 + */
904 +function collapse_node(node, user_cfg) {
user_cfg needs to be documented here, too.
[16]
939 +/**
940 + * Expand the node and set its arrow to 'collapsed'
941 + * @param node The node to collapse.
942 + */
943 +function expand_node(node, user_cfg) {
Same as [15].
[17]
977 +/** content_ box_id, hide_recipient_ picker) {
978 + * Construct the overlay and populate it with the add/edit form.
979 + *
980 + * @method setup_overlay
981 + * @param {String} content_box_id Id of the element on the page where
982 + * the overlay is anchored.
983 + * @return {String} overlay_id Id of the constructed overlay element.
984 + */
985 +function setup_overlay(
There's no overlay_id parameter, so you can drop the documentation for
it.
[18]
1242 + // if we want to allow editing of the recipient, do this instead
1243 + // of the if/else block below.
1244 + // set_recipient(
1245 + // content_node, subscriber_is_team, team_link);
Can this be dropped from the code or are we going to be using it later?
[19]
These all need documentation:
1182 +function get_input_ by_value( node, value) { node, all, checked) { buttons( node, all, value) { handler( subscription, filter_info, filter_id, handler( filter, filter_id, subscriber_id) { edit_links( config, context) { edit_links( config, context) { filter_ name(filter_ info, filter) { filter_ description( filter) { config( config) {
1189 +function set_checkboxes(
1200 +function set_options(node, name, value) {
1207 +function set_radio_
1211 +function set_recipient(node, is_team, team_link) {
1220 +function make_edit_
1221 + config, context) {
1309 +function make_delete_
1337 +function wire_up_
1337 +function wire_up_
1436 +function render_
1450 +function render_
1498 +function validate_
As do:
1754 + test_logged_ in_user: function() { selector_ controls: function() { recipient: function() { recipient: function() { s_select_ all_none: function() { select_ all_none: function() { error_handling_ adding: function() { error_handling_ patching: function() {
1761 + test_list_contains: function() {
1773 + test_make_
1838 + test_user_
1847 + test_team_
1989 + test_importance
2003 + test_statuses_
2065 + test_overlay_
2083 + test_overlay_
The test_extract_* tests in the extract_form_data test case could do
with some documentation too, though I realise there'd be a lot of
boilerplate there. Maybe one comment for the test case would suffice.
[20]
1918 + // When initialized the <div> elements for the filter
1919 + // wrapper and the accordion wrapper should be collapsed.
1920 + // Since the collapsing is done via animation, we must
1921 + // wait a bit for it to happen.
In the comments here you talk about waiting for something to happen, but
I don't see any calls to this.wait() in this test. Can this statement be
removed?