Merge lp:~jtv/launchpad/bug-894690 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 14391
Proposed branch: lp:~jtv/launchpad/bug-894690
Merge into: lp:launchpad
Diff against target: 28 lines (+4/-3)
1 file modified
lib/lp/translations/javascript/importqueue.js (+4/-3)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-894690
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+83413@code.launchpad.net

Commit message

[r=rvb][bug=894690] Restored vanished status field on translations import queue pages.

Description of the change

= Summary =

The entry-status field (including selector, if appropriate) went missing on the translations import queue pages. We need these fields!

== Proposed fix ==

The cause was a change that replaced a style="display:none" attribute with a more appropriate class="hidden". Why did that break things? Because the page's javascript revealed the field by doing setStyle('display', '').

Now that the field is hidden by a class instead of a style attribute, it should be revealed through a removeClass('hidden').

== Pre-implementation notes ==

Raphaël followed my reasoning. I didn't consult anyone on the fix as such.

This kind of bug is surprisingly hard to test for. Even if the authors of the code could have seen the change coming, it's hard to catch: a full-blown python/TAL/javascript test might well miss it. And such a test could be unfeasibly expensive for this kind of detail.

== Implementation details ==

I also fixed a bit of lint, where a comparison was done as “==” instead of the seemingly more appropriate “===”.

== Tests ==

You've got me there. How does one test this effectively? I tried setting up a new unit test, to at least test that the function now removes the "hidden" attribute if it's there. But I found myself unable to get it to work, as well as unable to pinpoint the failure in the debugger (although I did get to see a nice firefox crash). And yet the clock is ticking while users are hindered in their work.

So, with reluctance and self-loathing, I offer no test for this change. I'm sorry; I have failed you.

== Demo and Q/A ==

Go to any of the translations import queue pages, such as:

    https://translations.qastaging.launchpad.net/+imports

(Or similar on dev, which is what I did, or elsewhere.)

The right-hand side of the page should show the status of each entry — Approved, Needs Review, Blocked, Imported, Failed, or Needs Information. This column is currently missing.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/translations/javascript/importqueue.js

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good :)

review: Approve
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Thanks! I do hope we can improve the testability of this code at some point, but I'm afraid that's just yet another one of those tech-debt exercises.

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

On 11-11-25 02:23 PM, Jeroen T. Vermeulen wrote:
> Thanks! I do hope we can improve the testability of this code at some point,
> but I'm afraid that's just yet another one of those tech-debt exercises.

Excuses!

JFDI FTW

--
Francis J. Lacoste
<email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/javascript/importqueue.js'
2--- lib/lp/translations/javascript/importqueue.js 2011-02-24 00:23:04 +0000
3+++ lib/lp/translations/javascript/importqueue.js 2011-11-25 16:06:25 +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 * @module lp.translations.importqueue
10@@ -116,7 +116,8 @@
11 * which is defined in a code fragment that is included in the page via TAL.
12 */
13 var init_status_choice = function(content_box, index, list) {
14- content_box.setStyle('display', '');
15+ // Reveal the status widget.
16+ content_box.removeClass('hidden');
17 var conf = choice_confs[index];
18 conf.title = 'Change status to';
19 conf.contentBox = content_box;
20@@ -135,7 +136,7 @@
21 on: {
22 success: function(entry) {
23 Y.Array.each(conf.items, function(item) {
24- if (item.value == new_status) {
25+ if (item.value === new_status) {
26 value_box.addClass(item.css_class);
27 } else {
28 value_box.removeClass(item.css_class);