Merge lp:~bac/launchpad/bug-705594 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 12247
Proposed branch: lp:~bac/launchpad/bug-705594
Merge into: lp:launchpad
Diff against target: 208 lines (+45/-26)
1 file modified
lib/lp/bugs/javascript/bugtask_index.js (+45/-26)
To merge this branch: bzr merge lp:~bac/launchpad/bug-705594
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code js Approve
Review via email: mp+46970@code.launchpad.net

Commit message

[r=deryck][ui=none][bug=705594] Use the correct target when red-flashing JS errors on the bug page.

Description of the change

= Summary =

Redflash target for display_error is wrong in some cases.

== Proposed fix ==

Fix the target. Think about removing redflash in the future.

== Pre-implementation notes ==

Talk with Benji.

== Implementation details ==

As above.

== Tests ==

* None *

== Demo and Q/A ==

On lp.dev select 'link a related branch', search for a branch but don't
select it. Before selecting, kill the server so that the selection
fails. Look to see the correct target is flashed when the branch is
selected.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

Simple and easy. Thanks for fixing this!

review: Approve (code js)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
2--- lib/lp/bugs/javascript/bugtask_index.js 2011-01-14 12:50:23 +0000
3+++ lib/lp/bugs/javascript/bugtask_index.js 2011-01-20 21:42:16 +0000
4@@ -1,4 +1,4 @@
5-/* Copyright 2009 Canonical Ltd. This software is licensed under the
6+/* Copyright 2009-2011 Canonical Ltd. This software is licensed under the
7 * GNU Affero General Public License version 3 (see the file LICENSE).
8 *
9 * Form overlay widgets and subscriber handling for bug pages.
10@@ -183,8 +183,9 @@
11 update_dupe_url = update_dupe_link.get('href');
12 var mark_dupe_form_url = update_dupe_url + '/++form++';
13
14- var form_header = '<p>Marking this bug as a duplicate will, by default, ' +
15- 'hide it from search results listings.</p>';
16+ var form_header = '<p>Marking this bug as a duplicate will,' +
17+ ' by default, hide it from search results ' +
18+ 'listings.</p>';
19
20 var has_dupes = Y.one('#portlet-duplicates');
21 if (has_dupes !== null) {
22@@ -228,7 +229,8 @@
23 privacy_link = Y.one('#privacy-link');
24
25 if (privacy_link) {
26- var privacy_link_url = privacy_link.getAttribute('href') + '/++form++';
27+ var privacy_link_url = privacy_link.getAttribute('href') +
28+ '/++form++';
29 var privacy_div = Y.one('#privacy-text');
30 var privacy_html = privacy_link.get('innerHTML') + ' ';
31 privacy_div.set('innerHTML', privacy_html);
32@@ -495,7 +497,8 @@
33 var container = Y.one('#add-comment-form');
34 var first_node = container.get('firstChild');
35 duplicate_warning = Y.Node.create(
36- ['<div class="warning message" id="warning-comment-on-duplicate">',
37+ ['<div class="warning message"',
38+ 'id="warning-comment-on-duplicate">',
39 'Remember, this bug report is a duplicate. ',
40 'Comment here only if you think the duplicate status is wrong.',
41 '</div>'].join(''));
42@@ -598,7 +601,8 @@
43 ' id="security-message"',
44 '>Security vulnerability</div>'
45 ].join('');
46- security_message = Y.Node.create(security_message_html);
47+ security_message = Y.Node.create(
48+ security_message_html);
49 privacy_div.appendChild(security_message);
50 }
51 } else {
52@@ -627,7 +631,8 @@
53 link_branch_link.toggleClass('update-in-progress-message');
54 };
55 error_handler.showError = function(error_msg) {
56- Y.lp.app.errors.display_error(Y.one('.menu-link-addsubscriber'), error_msg);
57+ Y.lp.app.errors.display_error(
58+ Y.one('.menu-link-addbranch'), error_msg);
59 };
60
61 function get_branch_and_link_to_bug(data) {
62@@ -669,7 +674,8 @@
63 link_branch_link.toggleClass('update-in-progress-message');
64 };
65 error_handler.showError = function(error_msg) {
66- Y.lp.app.errors.display_error(Y.one('.menu-link-addsubscriber'), error_msg);
67+ Y.lp.app.errors.display_error(
68+ Y.one('.menu-link-addbranch'), error_msg);
69 };
70
71 // Call linkBranch() on the bug.
72@@ -873,7 +879,8 @@
73 if (all_subscribers.size() > 0) {
74 all_subscribers.each(function(sub_link) {
75 if (sub_link.getAttribute('id') != 'temp-username') {
76- // User's displayname is found via the link's "name" attribute.
77+ // User's displayname is found via the link's "name"
78+ // attribute.
79 var sub_link_name = sub_link.one('a').getAttribute('name');
80 nodes_by_name[sub_link_name] = sub_link;
81 if (sub_link.one('img.unsub-icon')) {
82@@ -970,7 +977,8 @@
83
84 // Set the click handler if adding a remove icon.
85 if (subscription.can_be_unsubscribed_by_user()) {
86- var remove_icon = Y.one('#unsubscribe-icon-' + person.get('css_name'));
87+ var remove_icon =
88+ Y.one('#unsubscribe-icon-' + person.get('css_name'));
89 remove_icon.on('click', function(e) {
90 e.halt();
91 unsubscribe_user_via_icon(e.target, subscription);
92@@ -1223,7 +1231,8 @@
93 subscription_link, true, false);
94 }
95
96- // Handle the case where the subscriber's list displays "None".
97+ // Handle the case where the subscriber's list displays
98+ // "None".
99 var empty_subscribers = Y.one("#none-subscribers");
100 if (empty_subscribers) {
101 var parent = empty_subscribers.get('parentNode');
102@@ -1349,7 +1358,8 @@
103 return;
104 }
105
106- if ((LP.client.links.me !== undefined) && (LP.client.links.me !== null)) {
107+ if ((LP.client.links.me !== undefined) &&
108+ (LP.client.links.me !== null)) {
109 if (Y.Lang.isValue(bugtarget_content)) {
110 if (conf.target_is_product) {
111 if (Y.UA.webkit) {
112@@ -1379,7 +1389,8 @@
113 title: 'Change status to',
114 items: conf.status_widget_items,
115 elementToFlash: status_content.get('parentNode'),
116- backgroundColor: tr.hasClass('highlight') ? '#FFFF99' : '#FFFFFF'
117+ backgroundColor:
118+ tr.hasClass('highlight') ? '#FFFF99' : '#FFFFFF'
119 });
120 status_choice_edit.showError = function(err) {
121 Y.lp.app.errors.display_error(null, err);
122@@ -1411,7 +1422,8 @@
123 title: 'Change importance to',
124 items: conf.importance_widget_items,
125 elementToFlash: importance_content.get('parentNode'),
126- backgroundColor: tr.hasClass('highlight') ? '#FFFF99' : '#FFFFFF'
127+ backgroundColor:
128+ tr.hasClass('highlight') ? '#FFFF99' : '#FFFFFF'
129 });
130 importance_choice_edit.showError = function(err) {
131 Y.lp.app.errors.display_error(null, err);
132@@ -1427,8 +1439,9 @@
133 });
134 // Set the inline form control's value, so that submitting
135 // it won't override the value we just set.
136- Y.one(document.getElementById(conf.prefix + '.importance')).set(
137- 'value', importance_choice_edit.get('value'));
138+ Y.one(document.getElementById(
139+ conf.prefix + '.importance')).set(
140+ 'value', importance_choice_edit.get('value'));
141 });
142 importance_choice_edit.plug({
143 fn: Y.lp.client.plugins.PATCHPlugin, cfg: {
144@@ -1472,7 +1485,8 @@
145 document.getElementById(conf.prefix + '.milestone'));
146 if (Y.Lang.isValue(inline_combo)) {
147 inline_combo.set('value', null);
148- Y.Array.each(milestone_choice_edit.get('items'), function(item) {
149+ Y.Array.each(
150+ milestone_choice_edit.get('items'), function(item) {
151 if (item.value == milestone_choice_edit.get('value')) {
152 inline_combo.all('option').each(function(opt) {
153 if (opt.get('innerHTML') == item.name) {
154@@ -1710,7 +1724,8 @@
155 function check_can_be_unsubscribed(subscription) {
156 var error_handler = new LP.client.ErrorHandler();
157 error_handler.showError = function (error_msg) {
158- Y.lp.app.errors.display_error(Y.one('.menu-link-addsubscriber'), error_msg);
159+ Y.lp.app.errors.display_error(
160+ Y.one('.menu-link-addsubscriber'), error_msg);
161 };
162
163 var config = {
164@@ -1735,7 +1750,8 @@
165 subscription.set('can_be_unsubscribed', true);
166 add_temp_user_name(subscription);
167 } else {
168- subscription.set('can_be_unsubscribed', false);
169+ subscription.set(
170+ 'can_be_unsubscribed', false);
171 add_temp_user_name(subscription);
172 }
173 },
174@@ -1747,7 +1763,8 @@
175 if (is_team) {
176 // Get a list of members to see if current user
177 // is a team member.
178- var members = result.get('members_details_collection_link');
179+ var members = result.get(
180+ 'members_details_collection_link');
181 lp_client.get(members, final_config);
182 } else {
183 subscription.set('can_be_unsubscribed', false);
184@@ -1779,7 +1796,8 @@
185
186 var error_handler = new LP.client.ErrorHandler();
187 error_handler.showError = function(error_msg) {
188- Y.lp.app.errors.display_error(Y.one('.menu-link-addsubscriber'), error_msg);
189+ Y.lp.app.errors.display_error(
190+ Y.one('.menu-link-addsubscriber'), error_msg);
191 };
192
193 if (subscription.is_already_subscribed()) {
194@@ -1916,8 +1934,9 @@
195 Y.io(url, config);
196 }
197
198-}, "0.1", {"requires": ["base", "oop", "node", "event", "io-base", "json-parse",
199- "substitute", "widget-position-ext", "lazr.formoverlay",
200- "lazr.anim", "lazr.base", "lazr.overlay",
201- "lazr.choiceedit", "lp.app.picker", "lp.client.plugins",
202- "lp.bugs.subscriber", "lp.app.errors"]});
203+}, "0.1", {"requires": ["base", "oop", "node", "event", "io-base",
204+ "json-parse", "substitute", "widget-position-ext",
205+ "lazr.formoverlay", "lazr.anim", "lazr.base",
206+ "lazr.overlay", "lazr.choiceedit", "lp.app.picker",
207+ "lp.client.plugins", "lp.bugs.subscriber",
208+ "lp.app.errors"]});