Closed
Bug 1102432
Opened 9 years ago
Closed 9 years ago
Rooms list should clean up when I log in and out of FxA
Categories
(Hello (Loop) :: Client, defect, P1)
Hello (Loop)
Client
Tracking
(firefox35+ verified, firefox36+ verified, firefox37 verified)
backlog | Fx35+ |
People
(Reporter: mreavy, Assigned: mikedeboer, Mentored)
References
Details
Attachments
(1 file, 3 obsolete files)
12.22 KB,
patch
|
NiKo
:
review+
Sylvestre
:
approval-mozilla-aurora+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Rooms I see as a logged in user should not appear when I log out and become Guest. Similarly, Rooms I see as Guest should not appear in my Rooms list when I log in to FxA.
Reporter | ||
Updated•9 years ago
|
backlog: --- → Fx35+
Priority: -- → P1
Assignee | ||
Comment 1•9 years ago
|
||
This is _very_ similar to the database switch done for LoopContacts. I can work on this, but if there's another taker, I advice you to take that logic as a starting point. There's definitely prior art here, so this shouldn't be hard to implement.
Assignee | ||
Updated•9 years ago
|
Mentor: mdeboer
Assignee | ||
Updated•9 years ago
|
Points: --- → 3
Flags: qe-verify+
Flags: firefox-backlog+
OS: Windows 7 → All
Hardware: x86_64 → All
Comment 2•9 years ago
|
||
Marco, can you please add this to the 37.1 iteration tracking? Thanks!
Assignee: nobody → jaws
Status: NEW → ASSIGNED
Iteration: --- → 37.1
Flags: needinfo?(mmucci)
Comment 4•9 years ago
|
||
(In reply to Mike de Boer [:mikedeboer] from comment #1) > This is _very_ similar to the database switch done for LoopContacts. I can > work on this, but if there's another taker, I advice you to take that logic > as a starting point. > > There's definitely prior art here, so this shouldn't be hard to implement. Kind of a cryptic message for those of us that can't read your mind ;) Are you referring to http://hg.mozilla.org/mozilla-central/annotate/ced1402861b8/browser/components/loop/MozLoopAPI.jsm#l267 ?
Flags: needinfo?(mdeboer)
Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #4) > Kind of a cryptic message for those of us that can't read your mind ;) Are > you referring to > http://hg.mozilla.org/mozilla-central/annotate/ced1402861b8/browser/ > components/loop/MozLoopAPI.jsm#l267 ? I apologize for not being more specific! The code I'm referring to is https://hg.mozilla.org/integration/fx-team/annotate/2273193cc525/browser/components/loop/MozLoopService.jsm#l241 So when the profile changes from FxA account to null --> clear the rooms cache in LoopRooms.jsm and set the dirty flag. Additionally, an event should be emitted to notify the UI that the list was cleared/ reset. When the profile changes from null to FxA account --> same. Nothing will be cleared, but an event should be emitted by LoopRooms to inform the UI that it should fetch the list of rooms again.
Flags: needinfo?(mdeboer)
Comment 6•9 years ago
|
||
My experience: Fx profile 1: Sign into FxA, create room 1, sign out, close Firefox Fx profile 2: Open Firefox with a different profile and sign in: room 1 does not appear on the list If I close Firefox and open it again with profile 2, after a small delay room 1 appears.
Comment 7•9 years ago
|
||
(In reply to Mike de Boer [:mikedeboer] from comment #5) > When the profile changes from null to FxA account --> same. Nothing will be > cleared, but an event should be emitted by LoopRooms to inform the UI that > it should fetch the list of rooms again. "Nothing will be cleared"? From our discussion during yesterday's standup it sounded like we wanted to clear out rooms that were created by a guest when sign-in occurred.
Assignee | ||
Comment 8•9 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #7) > "Nothing will be cleared"? From our discussion during yesterday's standup it > sounded like we wanted to clear out rooms that were created by a guest when > sign-in occurred. Ah of course, guests can create rooms too. All the better! Makes the implementation simpler :)
Reporter | ||
Comment 9•9 years ago
|
||
[Tracking Requested - why for this release]: We need this fix for "Rooms", which is already enabled in Fx35.
tracking-firefox35:
--- → ?
tracking-firefox36:
--- → ?
Comment 10•9 years ago
|
||
Hi Jared, Is this a bug you're able to do this week so we can uplift into Beta Monday for testing?
Flags: needinfo?(mreavy)
Flags: needinfo?(jaws)
Comment 11•9 years ago
|
||
Flags: needinfo?(jaws)
Updated•9 years ago
|
Flags: needinfo?(mreavy)
Updated•9 years ago
|
Iteration: 37.1 → 37.2
Assignee | ||
Comment 12•9 years ago
|
||
Hi Jared, just to touch base here, I wanted to show you what I was thinking about as a possible route to solving this issue.
Comment 13•9 years ago
|
||
Comment on attachment 8533703 [details] [diff] [review] WIP touch base Review of attachment 8533703 [details] [diff] [review]: ----------------------------------------------------------------- Yeah, this is what I arrived at when I was working with you last week, but I thought maybe we could make our getAll() function smarter and have that remove the rooms that didn't come back from the server. That way we wouldn't need the global. But this is probably simpler to follow, at the expense of introducing more global state tracking. I'm unable to test this patch out on my machine because I don't have the backend room server setup (I can't log-in or create rooms with just my localhost:3000/make runserver setup). I'll file a bug about allowing the locally run server to communicate with the development server backend.
Attachment #8533703 -
Flags: review+
Comment 14•9 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #13) > I'll file a bug > about allowing the locally run server to communicate with the development > server backend. Filed bug 1109269.
Comment 15•9 years ago
|
||
Comment on attachment 8533703 [details] [diff] [review] WIP touch base Review of attachment 8533703 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/components/loop/LoopRooms.jsm @@ +489,5 @@ > + gCurrentUser = user; > + gDirty = true; > + this.rooms.clear(); > + eventEmitter.emit("refresh"); > + this.getAll(() => {}); This should be, this.getAll(null, () => {});
Assignee | ||
Updated•9 years ago
|
Assignee: jaws → mdeboer
Flags: needinfo?(mmucci)
Assignee | ||
Comment 16•9 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #13) > But this is probably simpler to follow, at the expense of introducing more > global state tracking. I'm unable to test this patch out on my machine > because I don't have the backend room server setup (I can't log-in or create > rooms with just my localhost:3000/make runserver setup). I'll file a bug > about allowing the locally run server to communicate with the development > server backend. Cool! Note that you can use the dev server too by setting the `loop.server` pref to 'https://loop-dev.stage.mozaws.net/v0/' (source: https://wiki.mozilla.org/CloudServices/Loop/Deploy#Dev). I'll work on adding a test next.
Assignee | ||
Comment 19•9 years ago
|
||
Improved patch, now with tests! Niko, welcome to the desktop team! :-) Can you review the unit tests? Thanks!
Attachment #8532282 -
Attachment is obsolete: true
Attachment #8533703 -
Attachment is obsolete: true
Attachment #8534961 -
Flags: review?(nperriault)
Comment on attachment 8534961 [details] [diff] [review] Patch v2: refresh the list of rooms upon account switch or logout Review of attachment 8534961 [details] [diff] [review]: ----------------------------------------------------------------- I'm definitely not familiar with chrome-style JavaScript, so some remarks might be inaccurate/missing the point. The patch fixes the issue so r=me here, though feel free to address nits if you feel so. ::: browser/components/loop/LoopRooms.jsm @@ +34,5 @@ > // of date. The Push server may notify us of this event, which will set the global > // 'dirty' flag to TRUE. > let gDirty = true; > +// Global variable that keeps track of the currently used account. > +let gCurrentUser = null; Note: I won't be too picky about using a global here as it seems to be common practice in Gecko code, but I'm a little concerned with mutable state and testability here. Hope we'll have some good discussion about this someday. @@ +482,5 @@ > this.getAll(version, () => {}); > }, > + > + /** > + * When a user log in or logs out, this method should be invoked to check Nit: s/log in or logs out/logs in or out @@ +487,5 @@ > + * whether the rooms cache needs to be refreshed. > + * > + * @param {String|null} user The FxA userID or NULL > + */ > + maybeRefresh: function(user = null) { Is this a monad? :D More seriously, I'd have naturally expected the LoopRooms "module" to listen to an event (triggered from the service), though as it has no constructor I can't see any obvious place where we could do that :/ @@ +496,5 @@ > + gCurrentUser = user; > + gDirty = true; > + this.rooms.clear(); > + eventEmitter.emit("refresh"); > + this.getAll(null, () => {}); Nit: It's still a bit strange to me that we need to call *get*Something to perform side-effects… Maybe that's something we could file a [tech-debt] bug for? ::: browser/components/loop/MozLoopService.jsm @@ +243,5 @@ > notifyStatusChanged: function(aReason = null) { > log.debug("notifyStatusChanged with reason:", aReason); > let profile = MozLoopService.userProfile; > LoopStorage.switchDatabase(profile ? profile.uid : null); > + LoopRooms.maybeRefresh(profile ? profile.uid : null); Nit: profile && profile.uid || null is an alternative idiom (I personally tend to favor it though no big deal.) ::: browser/components/loop/content/shared/js/roomStore.js @@ +193,5 @@ > + _onRoomsRefresh: function(eventName) { > + this.dispatchAction(new sharedActions.UpdateRoomList({ > + roomList: [] > + })); > + }, This should be tested, have a look in roomStore_test.js. Note that tests might be added as a part 2, though it's often useful to read the tests along implementation :)
Attachment #8534961 -
Flags: review?(nperriault) → review+
Comment 21•9 years ago
|
||
I just tried applying this and test_loopservice_busy.js failed.
Comment 22•9 years ago
|
||
> ::: browser/components/loop/MozLoopService.jsm
> @@ +243,5 @@
> > notifyStatusChanged: function(aReason = null) {
> > log.debug("notifyStatusChanged with reason:", aReason);
> > let profile = MozLoopService.userProfile;
> > LoopStorage.switchDatabase(profile ? profile.uid : null);
> > + LoopRooms.maybeRefresh(profile ? profile.uid : null);
>
> Nit: profile && profile.uid || null is an alternative idiom (I personally
> tend to favor it though no big deal.)
Actually in this case, as well as the case for LoopStorage.switchDatabase, we don't need to pass the UID or null. We can just pass (profile && profile.uid) since both of these only care about the presence of a UID and not actually what that UID is.
Assignee | ||
Comment 23•9 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #22) > Actually in this case, as well as the case for LoopStorage.switchDatabase, > we don't need to pass the UID or null. We can just pass (profile && > profile.uid) since both of these only care about the presence of a UID and > not actually what that UID is. Not true, LoopStorage _does_ care what the value of uid is.
Assignee | ||
Comment 24•9 years ago
|
||
(In reply to Mike de Boer [:mikedeboer] from comment #23) > Not true, LoopStorage _does_ care what the value of uid is. But I think I see what you meant now; LoopStorage.switchDatabase treats all falsy values the same. So yeah, we can use the shorthand here.
Assignee | ||
Comment 25•9 years ago
|
||
(In reply to Nicolas Perriault (:NiKo`) — needinfo me if you need my attention from comment #20) > Note: I won't be too picky about using a global here as it seems to be > common practice in Gecko code, but I'm a little concerned with mutable state > and testability here. Hope we'll have some good discussion about this > someday. Globals in Gecko JS modules (.jsm files, usually), are evaluated in their own compartment, which is 'alive' during the lifetime of that module. In other words; global variables like this are only global to the modules' internals, not outside of it. Neat, eh?
Assignee | ||
Comment 26•9 years ago
|
||
Attachment #8534961 -
Attachment is obsolete: true
Attachment #8537230 -
Flags: review?(nperriault)
Comment on attachment 8537230 [details] [diff] [review] Patch v3: refresh the list of rooms upon account switch or logout Review of attachment 8537230 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, ship it :)
Attachment #8537230 -
Flags: review?(nperriault) → review+
Assignee | ||
Comment 28•9 years ago
|
||
Nice. Pushed to fx-team as: https://hg.mozilla.org/integration/fx-team/rev/5f189920c4d1
Comment 29•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5f189920c4d1
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Comment 30•9 years ago
|
||
Mike, could you fill the uplift request for aurora & beta? thanks
Assignee | ||
Comment 31•9 years ago
|
||
Comment on attachment 8537230 [details] [diff] [review] Patch v3: refresh the list of rooms upon account switch or logout Approval Request Comment [Feature/regressing bug #]: loop rooms [User impact if declined]: When the user logs in with a second Fx Account, he/ she will see the old list of rooms in the UI. [Describe test coverage new/current, TBPL]: Landed on m-c, tests added and pass [Risks and why]: minor [String/UUID change made/needed]: n/a.
Flags: needinfo?(mdeboer)
Attachment #8537230 -
Flags: approval-mozilla-beta?
Attachment #8537230 -
Flags: approval-mozilla-aurora?
Reporter | ||
Comment 32•9 years ago
|
||
Thanks, Mike. FYI for sheriffs: Once we get aurora and beta approvals for this patch, Randell (Jesup) and I will uplift this along with other approved Hello patches. (The target is to get everything uplifted before Monday.)
Updated•9 years ago
|
Updated•9 years ago
|
Attachment #8537230 -
Flags: approval-mozilla-beta?
Attachment #8537230 -
Flags: approval-mozilla-beta+
Attachment #8537230 -
Flags: approval-mozilla-aurora?
Attachment #8537230 -
Flags: approval-mozilla-aurora+
Reporter | ||
Comment 33•9 years ago
|
||
We will be uplifting this to Fx35 this weekend (before Monday), but the patch is not there yet.
Comment 35•9 years ago
|
||
I checked this on aurora before pushing, BTW
Comment 37•9 years ago
|
||
Verified fixed 35RC, 36.0a2 (2015-01-06), 37.0a1 (2015-01-05) Win 7
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•