Notification (e.g. "Thank you for your bug report") appears in wrong window
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Triaged
|
High
|
Unassigned |
Bug Description
Symptoms
========
I just submitted two bug reports against the same package in Ubuntu nearly simultaneously. I did this using firefox from a slightly out-of-date gutsy, with two windows open onto
https:/
into which I'd filled the respective bug details. When I was satisfied with my two reports I used the mouse to click "Submit Bug Report" on both pages, one quickly after the other.
Both bugs appears to have been filed correctly at:
https:/
https:/
But, the window for 131160 starts with two copies of the "Thank you for your bug report" (i)nformation item, and the window for 131161 has neither. Incidentally, I think I pressed submit first on the window that became 131161.
Cause
=====
The page notification subsystem in Launchpad uses a session key that is in a cookie shared amongst all browser windows. POSTs are followed up by a redirect and the notification added to the GET of the page the browser was redirected to. The server then generates the page and dumps all outstanding notifications into the page content.
What we want to achieve is to notify a subset of events to the *current* window / process that is taking the action. This is perhaps something that the notification service should assist with - when the notification is a global one (vs e.g. 'field XYZ is not an integer'). This might be done by having the notification service API return a hint for 'include in the current action results'. Separately, *if* LP had a consistent timeline widget we could look at always including all subscribed events in responses to actions, and they would render on the right hand side; possibly client side logic could take care of all the side effects from the requested action.
Possible fixes
==============
* Include a notification reference in the redirect from the POST allowing a unique key to pickup specific notifications. (Users would see a query parameter on the url right after taking mutating-
* Render the final result immediately rather than redirecting from the POST. Users taking mutating pageload actions would see the url that the action was POSTed too which (in our current system) might be a bit ugly. On the upside this would be significantly faster - less duplicate DB access, less roundtrips.
* On the server side include the page the notification is for. Then when we dump notifications we'd only show the notifications that are relevant to the page the user ends up on. This is the simplest approach known of to-date.
* Use form nonces where the POST takes a nonce, visible in the referrer of the follow-on GET and thus usable to key into the notifications set.
* Move all 'this worked' etc notifications into the client side using the data returned from the API call. This would essentially deprecate the existing system.
Changed in launchpad-foundations: | |
status: | Confirmed → Triaged |
importance: | Undecided → Low |
Changed in launchpad: | |
importance: | Low → High |
description: | updated |
tags: | added: ui |
tags: | added: notifications |
description: | updated |
There are a number of trade-offs at work here, so I don't really see this bug getting fixed. I am subscribing Stuart, since he worked on this notification code.
When you post a form on Launchpad, we reply with a redirect to another page. This is done because hitting the reload button on a page that results from a POST will prompt the user to repost the data, which could then result in duplicate comments, bugs, etc. Lots of people do hit the reload button and few read the dialog (developers and users alike), so the post-then-redirect behaviour is required.
So the page where you see the notification is not being served by the request that set the notification. The notifications are handled through the session cookie. As cookies are handled on a per-instance basis rather than per-window or tab, all the windows you have open share the same session. In this case, the POST requests for the two bugs filed would have been processed creating the notifications, then the first window that issued the subsequent GET picked up the two notifications.
We used to solve this problem by appending a query parameter, but changed to the current implementation due to complaints about the ugly URLs (see bug 5412).