Bug 1202402 - Nothing shown on the standalone UI when a peer exits the room [r=Standard8]
authorEd Lee <edilee@mozilla.com>
Mon, 07 Sep 2015 14:20:58 -0700
changeset 291827 008aa66eb51f9ac8a9ee2ee33bd669b89c1a702c
parent 291826 e1ff9d517b133e5f0022a2dee70e88c5c9573ad7
child 291828 c69a3e313517275a1d6e37a939b5c879bc06371e
push id5263
push usermhaigh@mozilla.com
push dateThu, 10 Sep 2015 11:22:56 +0000
reviewersStandard8
bugs1202402
milestone43.0a1
Bug 1202402 - Nothing shown on the standalone UI when a peer exits the room [r=Standard8]
browser/components/loop/standalone/content/js/standaloneRoomViews.js
browser/components/loop/standalone/content/js/standaloneRoomViews.jsx
browser/components/loop/standalone/content/l10n/en-US/loop.properties
browser/components/loop/test/standalone/standaloneRoomViews_test.js
browser/locales/en-US/chrome/browser/loop/loop.properties
--- a/browser/components/loop/standalone/content/js/standaloneRoomViews.js
+++ b/browser/components/loop/standalone/content/js/standaloneRoomViews.js
@@ -114,19 +114,20 @@ loop.standaloneRoomViews = (function(moz
         case ROOM_STATES.SESSION_CONNECTED:
           this.setState({ waitToRenderWaiting: false });
           this.props.dispatcher.dispatch(new sharedActions.TileShown());
           break;
       }
     },
 
     componentDidUpdate: function() {
-      // Start a timer once from the earliest waiting state if we need to wait
-      // before showing a message.
-      if (this.props.roomState === ROOM_STATES.JOINING &&
+      // Start a timer once from the earliest waiting state or from the state
+      // after someone else leaves if we need to wait before showing a message.
+      if ((this.props.roomState === ROOM_STATES.JOINING ||
+           this.props.roomState === ROOM_STATES.SESSION_CONNECTED) &&
           this.state.waitToRenderWaiting &&
           this._waitTimer === undefined) {
         this._waitTimer = setTimeout(this._allowRenderWaiting,
           this.constructor.RENDER_WAITING_DELAY);
       }
     },
 
     componentWillReceiveProps: function(nextProps) {
@@ -224,17 +225,17 @@ loop.standaloneRoomViews = (function(moz
           // there's another participant that will momentarily appear.
           if (this.state.waitToRenderWaiting) {
             return null;
           }
 
           return (
             React.createElement("div", {className: "room-inner-info-area"}, 
               React.createElement("p", {className: "empty-room-message"}, 
-                mozL10n.get("rooms_only_occupant_label")
+                mozL10n.get("rooms_only_occupant_label2")
               ), 
               React.createElement("p", {className: "room-waiting-area"}, 
                 mozL10n.get("rooms_read_while_wait_offer"), 
                 React.createElement("a", {href: loop.config.tilesSupportUrl, 
                   onClick: this.recordTilesSupport, 
                   rel: "noreferrer", 
                   target: "_blank"}, 
                   React.createElement("i", {className: "room-waiting-help"})
--- a/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx
+++ b/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx
@@ -114,19 +114,20 @@ loop.standaloneRoomViews = (function(moz
         case ROOM_STATES.SESSION_CONNECTED:
           this.setState({ waitToRenderWaiting: false });
           this.props.dispatcher.dispatch(new sharedActions.TileShown());
           break;
       }
     },
 
     componentDidUpdate: function() {
-      // Start a timer once from the earliest waiting state if we need to wait
-      // before showing a message.
-      if (this.props.roomState === ROOM_STATES.JOINING &&
+      // Start a timer once from the earliest waiting state or from the state
+      // after someone else leaves if we need to wait before showing a message.
+      if ((this.props.roomState === ROOM_STATES.JOINING ||
+           this.props.roomState === ROOM_STATES.SESSION_CONNECTED) &&
           this.state.waitToRenderWaiting &&
           this._waitTimer === undefined) {
         this._waitTimer = setTimeout(this._allowRenderWaiting,
           this.constructor.RENDER_WAITING_DELAY);
       }
     },
 
     componentWillReceiveProps: function(nextProps) {
@@ -224,17 +225,17 @@ loop.standaloneRoomViews = (function(moz
           // there's another participant that will momentarily appear.
           if (this.state.waitToRenderWaiting) {
             return null;
           }
 
           return (
             <div className="room-inner-info-area">
               <p className="empty-room-message">
-                {mozL10n.get("rooms_only_occupant_label")}
+                {mozL10n.get("rooms_only_occupant_label2")}
               </p>
               <p className="room-waiting-area">
                 {mozL10n.get("rooms_read_while_wait_offer")}
                 <a href={loop.config.tilesSupportUrl}
                   onClick={this.recordTilesSupport}
                   rel="noreferrer"
                   target="_blank">
                   <i className="room-waiting-help"></i>
--- a/browser/components/loop/standalone/content/l10n/en-US/loop.properties
+++ b/browser/components/loop/standalone/content/l10n/en-US/loop.properties
@@ -92,17 +92,17 @@ rooms_default_room_name_template=Convers
 ## LOCALIZATION_NOTE(rooms_welcome_title): {{conversationName}} will be replaced
 ## by the user specified conversation name.
 rooms_welcome_title=Welcome to {{conversationName}}
 rooms_leave_button_label=Leave
 rooms_list_copy_url_tooltip=Copy Link
 rooms_list_delete_tooltip=Delete conversation
 rooms_list_deleteConfirmation_label=Are you sure?
 rooms_new_room_button_label=Start a conversation
-rooms_only_occupant_label=You're the first one here.
+rooms_only_occupant_label2=You're the only one here.
 rooms_panel_title=Choose a conversation or start a new one
 rooms_room_full_label=There are already two people in this conversation.
 rooms_room_full_call_to_action_nonFx_label=Download {{brandShortname}} to start your own
 rooms_room_full_call_to_action_label=Learn more about {{clientShortname}} »
 rooms_room_joined_label=Someone has joined the conversation!
 rooms_room_join_label=Join the conversation
 rooms_display_name_guest=Guest
 rooms_unavailable_notification_message=Sorry, you cannot join this conversation. The link may be expired or invalid.
--- a/browser/components/loop/test/standalone/standaloneRoomViews_test.js
+++ b/browser/components/loop/test/standalone/standaloneRoomViews_test.js
@@ -204,16 +204,27 @@ describe("loop.standaloneRoomViews", fun
 
       it("should not dispatch a `TileShown` action after a wait when in the HAS_PARTICIPANTS state",
         function() {
           activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
           clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
 
           sinon.assert.notCalled(dispatch);
         });
+
+      it("should dispatch a `TileShown` action after a wait when a participant leaves",
+        function() {
+          activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
+          clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
+          activeRoomStore.remotePeerDisconnected();
+          clock.tick(loop.standaloneRoomViews.StandaloneRoomInfoArea.RENDER_WAITING_DELAY);
+
+          sinon.assert.calledOnce(dispatch);
+          sinon.assert.calledWithExactly(dispatch, new sharedActions.TileShown());
+        });
     });
 
     describe("#componentWillReceiveProps", function() {
       var view;
 
       beforeEach(function() {
         view = mountTestComponent();
 
--- a/browser/locales/en-US/chrome/browser/loop/loop.properties
+++ b/browser/locales/en-US/chrome/browser/loop/loop.properties
@@ -319,17 +319,16 @@ rooms_leave_button_label=Leave
 rooms_list_copy_url_tooltip=Copy Link
 ## LOCALIZATION NOTE (rooms_list_recent_conversations): String is in all caps
 ## for emphasis reasons, it is a heading. Proceed as appropriate for locale.
 rooms_list_recent_conversations=RECENT CONVERSATIONS
 rooms_list_delete_tooltip=Delete conversation
 rooms_list_deleteConfirmation_label=Are you sure?
 rooms_change_failed_label=Conversation cannot be updated
 rooms_new_room_button_label=Start a conversation
-rooms_only_occupant_label=You're the first one here.
 rooms_panel_title=Choose a conversation or start a new one
 rooms_room_full_label=There are already two people in this conversation.
 rooms_room_full_call_to_action_nonFx_label=Download {{brandShortname}} to start your own
 rooms_room_full_call_to_action_label=Learn more about {{clientShortname}} »
 rooms_room_joined_label=Someone has joined the conversation!
 rooms_room_join_label=Join the conversation
 rooms_signout_alert=Open conversations will be closed