Merge lp:~nigelbabu/launchpad/bug-title-849121 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13967 |
Proposed branch: | lp:~nigelbabu/launchpad/bug-title-849121 |
Merge into: | lp:launchpad |
Diff against target: |
308 lines (+150/-46) 5 files modified
lib/lp/app/browser/linkchecker.py (+17/-11) lib/lp/app/browser/tests/test_linkchecker.py (+12/-2) lib/lp/app/javascript/lp-links.js (+35/-33) lib/lp/app/javascript/tests/test_lp_links.html (+32/-0) lib/lp/app/javascript/tests/test_lp_links.js (+54/-0) |
To merge this branch: | bzr merge lp:~nigelbabu/launchpad/bug-title-849121 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | code | Approve | |
Raphaël Badin (community) | code* | Approve | |
Review via email: mp+75267@code.launchpad.net |
Commit message
[r=allenap,rvb][bug=849121] For bug links in Launchpad, add the bug's title to "title" attribute of the URL if the bug is valid.
Description of the change
= Description =
Adds the bug title to "title" attribute if the bug is valid. My earlier commits to those tests didn't actually test the bugs bit. I've also added YUI tests for lp-links.js. It didn't have a test until now, and my changes were extensive enough that I probably wouldn't get away without it ;-)
Instead of this
{"invalid_
We now have
{"bug_links": {"valid": {"/bugs/14": "jokosher exposes personal details in its actions portlet"}, "invalid": {"/bugs/200": "Bug 200 cannot be found"}}, "branch_links": {"invalid": {"/+branch/foobar": "No such product: 'foobar'."}}}
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
43: Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead.
52: Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead.
make: *** [lint] Error 2
Hi Nigel, thanks a lot for this branch. Thanks for fixing the lint errors. It looks great but I spotted a few things I'd like you too fix before we land this.
[1]
30 - bug_ids = getUtility( IBugTaskSet) .searchBugIds( params) IBugTaskSet) .search( params) '/bugs/ ' + str(task.bug.id)] = task.bug.title task.bug. id)
31 - invalid = set(bugs) - set(bug_ids)
32 - for bug in invalid:
33 + bugtasks = getUtility(
34 + for task in bugtasks:
35 + valid_links[
36 + bugs.remove(
37 + for bug in bugs:
Although the logic seems fine, I think this would be more clear if you iterate over a variable named 'invalid_bugs' (or something) like this was done before instead of creating that list dynamically like you do now.
[2]
137 + } else if( (href in valid_links) ) {
I think you can remove some parenthesis here.
9 - // ATM, we only handle +branch links.
150 + // ATM, we only handle +branch and bug links
Nitpick: please add the '.' at the end of the sentence ;).
[3]
257 + // Test the setup method.
I think this is a left-over ...?
[4]
171 + if( console !== undefined ) {
I know this is not your code in the first place but since you're fixing it (and doing a good job at it), you could use YUI's Y.Lang.isValue (see http:// developer. yahoo.com/ yui/docs/ YAHOO.lang. html) to check if console is undefined.
[5]
184 + process_ links(link_ info, 'branch- short-link' , invalid_ links(link_ info, 'bug-link', links(link_ info, 'bug-link',
185 'branch_links');
186 - process_
187 + process_
188 'bug_links');
Again, not your code but maybe you could fix the indentation here.
[6]
261 + links.check_ valid_lp_ links(mock_ io); invalid" : "No such', '."}}}' ].join( '');
262 + var response_json = ['{"bug_links": {"valid": {"/bugs/14"',
263 + ': "jokosher exposes personal details in its actions portlet"}',
264 + ', "invalid": {"/bugs/200": "Bug 200 cannot be found"}}, ',
265 + '"branch_links": {"invalid": {"/+branch/
266 + ' product: \'foobar\
My eyes! Formatting it this way makes it very difficult to read. Because you're using mockio you must build a string but my advice here would be to create the json object (properly formatted) and apply Y.JSON.stringify to it.
[7]
278 + Y.Assert.areSame( get('title' ));
279 + 'jokosher exposes personal details in its actions portlet',
280 + validbug.
281 + },
282 + test_branch: function () {
2 small formatting problem here:
- please add an empty line between the functions;
- please fix the indentation of the line which starts with "'jokosher" and the one that follow.