Merge lp:~wgrant/launchpad/tiny-inline-subscription-fixes into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: not available
Proposed branch: lp:~wgrant/launchpad/tiny-inline-subscription-fixes
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~wgrant/launchpad/tiny-inline-subscription-fixes
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Review via email: mp+10454@code.launchpad.net
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

= Summary =

I picked up a couple of bugs in the inline subscription stuff while testing fixes for the other bugs earlier this week. I thought I might as well fix them now.

See the two linked bugs for details.

== Proposed fix ==

The team icon was showing up as the icon for self-subscription because the self-subscription handler doesn't set is_team -- only check_can_be_unsubscribed does. I've forced is_team to false when setting the current person on the subscription.

The unsubscription handler was unconditionally setting the 'add' class on the Unsubscribe link. I initially moved the manual class changes into the block that sets the text to "Subscribe", but later discovered subscription.disable_spinner(). I now instead use that.

== Tests ==

I've added Windmill tests for the two bugs.

 $ ./bin/lp-windmill -e test=lib/lp/bugs/windmill/tests/test_bugs/test_bug_inline_subscriber.py firefox http://bugs.launchpad.dev:8085

== Demo and Q/A ==

To Q/A:

Bug #415220:
 1. Subscribe yourself to a bug.
 2. Subscribe a team of which you are a member to the bug.
 4. Click the link to unsubscribe the team.
 5. Verify that the "(-) Unsubscribe" link retains the correct icon.

Bug #415219:
 1. Subscribe a team to a bug.
 2. Subscribe yourself to a bug (using "Subscribe", not "Subscribe someone else").
 3. Verify that the icon next to your name is the person, not team, icon.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

Good fix. Thanks for picking this up.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/javascript/bugs/bugtask-index.js'
2--- lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-08-20 04:52:29 +0000
3+++ lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-08-20 11:38:10 +0000
4@@ -294,6 +294,7 @@
5 e.halt();
6 subscription.set('can_be_unsubscribed', true);
7 subscription.set('person', subscription.get('subscriber'));
8+ subscription.set('is_team', false);
9 var parent = e.target.get('parentNode');
10 // Look for the false conditions of subscription, which
11 // is_direct_subscription, etc. don't report correctly,
12@@ -1030,7 +1031,7 @@
13 if (Y.Lang.isNull(person_link) &&
14 subscription.is_current_user_subscribing()) {
15 // Current user has been completely unsubscribed.
16- subscription_link.set('innerHTML', 'Subscribe');
17+ subscription.disable_spinner('Subscribe');
18 set_subscription_link_parent_class(
19 subscription_link, false, false);
20 subscription.set('is_direct', false);
21@@ -1050,8 +1051,6 @@
22 subscription.set('has_dupes', true);
23 }
24 }
25- subscription_link.removeClass('modify remove');
26- subscription_link.addClass('add');
27 });
28 anim.run();
29 },
30
31=== modified file 'lib/lp/bugs/windmill/tests/test_bugs/test_bug_inline_subscriber.py'
32--- lib/lp/bugs/windmill/tests/test_bugs/test_bug_inline_subscriber.py 2009-07-30 12:37:18 +0000
33+++ lib/lp/bugs/windmill/tests/test_bugs/test_bug_inline_subscriber.py 2009-08-20 10:28:37 +0000
34@@ -118,6 +118,14 @@
35 client.click(
36 xpath=u'//div[@class="yui-lazr-formoverlay-actions"]/button[2]')
37
38+ # If we subscribe the user again, the icon should still be the person icon.
39+ client.click(xpath=SUBSCRIPTION_LINK)
40+ client.waits.sleep(milliseconds=SLEEP)
41+ client.asserts.assertProperty(
42+ xpath=(PERSON_LINK % u'Sample Person') + '/span',
43+ validator=u'className|person')
44+
45+
46 # Sample Person is logged in currently. She is not a
47 # member of Ubuntu Team, and so, does not have permission
48 # to unsubscribe the team.
49@@ -135,6 +143,11 @@
50 client.click(id=u'unsubscribe-icon-subscriber-17')
51 client.waits.sleep(milliseconds=SLEEP)
52 client.asserts.assertNotNode(xpath=PERSON_LINK % u'Ubuntu Team')
53+ client.asserts.assertText(
54+ xpath=SUBSCRIPTION_LINK, validator=u'Unsubscribe')
55+ client.asserts.assertProperty(
56+ xpath=SUBSCRIPTION_LINK,
57+ validator=u'className|remove')
58
59 # Test unsubscribing via the remove icon for duplicates.
60 # First, go to bug 6 and subscribe.