Merge lp://staging/~gary/launchpad/bug-772754-2 into lp://staging/launchpad
Status: | Merged |
---|---|
Approved by: | Данило Шеган |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13243 |
Proposed branch: | lp://staging/~gary/launchpad/bug-772754-2 |
Merge into: | lp://staging/launchpad |
Prerequisite: | lp://staging/~gary/launchpad/bug792493 |
Diff against target: |
2182 lines (+1238/-638) 15 files modified
lib/canonical/launchpad/icing/style.css (+10/-0) lib/lp/bugs/browser/bug.py (+88/-57) lib/lp/bugs/browser/configure.zcml (+1/-1) lib/lp/bugs/browser/structuralsubscription.py (+14/-21) lib/lp/bugs/browser/tests/test_bug_views.py (+1/-13) lib/lp/bugs/javascript/bug_subscription_portlet.js (+385/-0) lib/lp/bugs/javascript/bugtask_index_portlets.js (+0/-519) lib/lp/bugs/javascript/tests/test_bug_subscription_portlet.html (+42/-0) lib/lp/bugs/javascript/tests/test_bug_subscription_portlet.js (+637/-0) lib/lp/bugs/javascript/tests/test_subscription.js (+4/-2) lib/lp/bugs/model/bug.py (+1/-1) lib/lp/bugs/model/structuralsubscription.py (+4/-5) lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt (+14/-7) lib/lp/bugs/templates/bug-portlet-subscription.pt (+36/-12) lib/lp/registry/javascript/structural-subscription.js (+1/-0) |
To merge this branch: | bzr merge lp://staging/~gary/launchpad/bug-772754-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Данило Шеган (community) | Approve | ||
Review via email:
|
Description of the change
This branch implements the subscriptions portlet part of the design from bug 772754. I adjusted the design a bit as I worked on it, but it's close to what I had there.
You can think of this diff in three parts:
(A) rip out the old subscription portlet code, including the bits that integrate with the subscriber portlet;
(B) change the rendering of the subscription portlet to match the new design, with or without JS; and
(C) add new subscription portlet JS code to handle subscriptions.
I'll divide up the diff into those three parts.
(A) rip out the old subscription portlet code
lib/lp/
Danilo's changes will make this file disappear!
(B) change the rendering of the subscription portlet
lib/canonical/
(No comment)
lib/lp/
We use a new view class so we can specify just what we need.
lib/lp/
Note that we are sharing the new strings with JavaScript by dumping them in the JSONRequestCache.
Note that user_should_
Note that we use an existing structural subscription function to determine whether the user has any pertinent structural subscriptions. That function had to be modified to return a result set. That function change resulted in changes in these files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
I had to make the test helper a bit more robust because I was using much fewer classes, and sometime none at all.
lib/lp/
(No comment)
lib/lp/
(No comment)
(C) add new subscription portlet JS code
lib/lp/
setup_
lib/lp/
(No comment)
lib/lp/
I copied LPClient yet again. We really should put that somewhere else, and better document it, and maybe polish it to make it easier to use/understand. I didn't want to do that now. I also noted the problem in lib/lp/
Beyond those bits, I had a single crazy whitespace change: lib/lp/
Thank you!
Gary
Hi Gary,
Thanks for working on this: it's a huge improvement over what we used to
have, and very nicely factored. I do have a few suggestions on some
further factoring and a few cleanups, but that's about it.
The only other remark of note that I have is that I find the UI
presentation a bit weird for the overlay.
None of the changes I propose are binding, and I find your branch pretty
good.
review approve
merge approve
> === modified file 'lib/lp/ bugs/browser/ bug.py' model.personsub scriptioninfo import PersonSubscriptions
...
> +from lp.bugs.
I like it that you are reusing the work that we've already done. Cool :)
> @@ -642,6 +607,79 @@ ileAlias( libraryfile, attachment) .http_url PortletView( BugView) :
> return ProxiedLibraryF
> attachment.
>
> +class BugSubscription
I might have missed them, but at least a test or two for this view would
be nice to have.
Also, I ain't sure if you could have used BugViewMixin instead of
BugView directly. Worth checking, imo.
... personal: notifications = True personal[ 0] subscription' ] = direct.subscription subscription. bug_notificatio n_level Level.COMMENTS: all_notificatio ns = True Level.METADATA: metadata_ notifications = True Level.LIFECYCLE lifecycle_ notifications = True subscription_ notifications = bool( subscriptions or duplicate. count or assignee. count or as_team_ member or as_team_ admin)
> +
> + def initialize(self):
...
> + if psi.direct.
> + self.direct_
> + direct = psi.direct.
> + cache['
> + level = direct.
> + if level == BugNotification
> + self.direct_
> + elif level == BugNotification
> + self.direct_
> + else:
> + assert level == BugNotification
> + self.direct_
> + self.other_
> + has_structural_
> + psi.from_
> + psi.as_owner.count or
> + psi.as_
> + psi.direct.
> + psi.direct.
I find this interesting. What happens with eg. LIFECYCLE duplicate
subscription? How are we to show that in the UI? Should my code include
the current user among the 'Other subscribers' if they have a duplicate
subscription?
> === modified file 'lib/lp/ bugs/browser/ bugsubscription .py' bugs/browser/ bugsubscription .py 2011-06-03 22:36:15 +0000 bugs/browser/ bugsubscription .py 2011-06-03 22:36:29 +0000 iptionListView, self).initialize() subscriptions_ for_bug( structural_ subscriptions_ for_bug( structural_ subscription_ data_to_ js( ions(
> --- lib/lp/
> +++ lib/lp/
> @@ -612,8 +612,8 @@
>
> def initialize(self):
> super(BugSubscr
> - subscriptions = get_structural_
> - self.context.bug, self.user)
> + subscriptions = list(get_
> + self.context.bug, self.user))
> expose_
> self.context, self.request, self.user, subscriptions)
> subscriptions_info = PersonSubscript
Looking at the code of expose_ structural_ subscription_ data_to_ js(), it subscriptions) ) and then calls ex...
should have worked with a ResultSet(): it checks the length with
len(list(