Bug 1212348 - Loop's RoomList view requires user profile data passed in when it doesn't need to. r=mikedeboer
authorMark Banner <standard8@mozilla.com>
Thu, 08 Oct 2015 11:30:06 +0100
changeset 266918 8c65c587460e5ae18c7cd06448707a133810e0e0
parent 266917 7c76e3d8a99791793062b5925951c4789a7cc50a
child 266919 ea8b6281c4f4404e185d0beb361fc1855d2330ba
push id66331
push userkwierso@gmail.com
push dateThu, 08 Oct 2015 21:35:51 +0000
treeherdermozilla-inbound@1a5167cd7688 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1212348
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1212348 - Loop's RoomList view requires user profile data passed in when it doesn't need to. r=mikedeboer
browser/components/loop/content/js/panel.js
browser/components/loop/content/js/panel.jsx
--- a/browser/components/loop/content/js/panel.js
+++ b/browser/components/loop/content/js/panel.js
@@ -663,19 +663,17 @@ loop.panel = (function(_, mozL10n) {
    * Room list.
    */
   var RoomList = React.createClass({displayName: "RoomList",
     mixins: [Backbone.Events, sharedMixins.WindowCloseMixin],
 
     propTypes: {
       dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
       mozLoop: React.PropTypes.object.isRequired,
-      store: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired,
-      // Used for room creation, associated with room owner.
-      userProfile: userProfileValidator
+      store: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired
     },
 
     getInitialState: function() {
       return this.props.store.getStoreState();
     },
 
     componentDidMount: function() {
       this.listenTo(this.props.store, "change", this._onStoreStateChanged);
@@ -698,21 +696,16 @@ loop.panel = (function(_, mozL10n) {
         this.closeWindow();
       }
     },
 
     _onStoreStateChanged: function() {
       this.setState(this.props.store.getStoreState());
     },
 
-    _getUserDisplayName: function() {
-      return this.props.userProfile && this.props.userProfile.email ||
-        mozL10n.get("display_name_guest");
-    },
-
     /**
      * Let the user know we're loading rooms
      * @returns {Object} React render
      */
     _renderLoadingRoomsView: function() {
       return (
         React.createElement("div", {className: "room-list"}, 
           React.createElement("div", {className: "room-list-loading"}, 
@@ -741,18 +734,17 @@ loop.panel = (function(_, mozL10n) {
       );
     },
 
     _renderNewRoomButton: function() {
       return (
         React.createElement(NewRoomView, {dispatcher: this.props.dispatcher, 
           mozLoop: this.props.mozLoop, 
           pendingOperation: this.state.pendingCreation ||
-                            this.state.pendingInitialRetrieval, 
-          userDisplayName: this._getUserDisplayName()})
+                            this.state.pendingInitialRetrieval})
       );
     },
 
     render: function() {
       if (this.state.error) {
         // XXX Better end user reporting of errors.
         console.error("RoomList error", this.state.error);
       }
@@ -787,18 +779,17 @@ loop.panel = (function(_, mozL10n) {
 
   /**
    * Used for creating a new room with or without context.
    */
   var NewRoomView = React.createClass({displayName: "NewRoomView",
     propTypes: {
       dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
       mozLoop: React.PropTypes.object.isRequired,
-      pendingOperation: React.PropTypes.bool.isRequired,
-      userDisplayName: React.PropTypes.string.isRequired
+      pendingOperation: React.PropTypes.bool.isRequired
     },
 
     mixins: [
       sharedMixins.DocumentVisibilityMixin,
       React.addons.PureRenderMixin
     ],
 
     getInitialState: function() {
@@ -997,18 +988,17 @@ loop.panel = (function(_, mozL10n) {
 
       return (
         React.createElement("div", {className: "panel-content"}, 
           React.createElement(NotificationListView, {
             clearOnDocumentHidden: true, 
             notifications: this.props.notifications}), 
             React.createElement(RoomList, {dispatcher: this.props.dispatcher, 
                       mozLoop: this.props.mozLoop, 
-                      store: this.props.roomStore, 
-                      userProfile: this.state.userProfile}), 
+                      store: this.props.roomStore}), 
           React.createElement("div", {className: "footer"}, 
             React.createElement("div", {className: "user-details"}, 
               React.createElement(AvailabilityDropdown, null)
             ), 
             React.createElement("div", {className: "signin-details"}, 
               React.createElement(AccountLink, {fxAEnabled: this.props.mozLoop.fxAEnabled, 
                            userProfile: this.state.userProfile}), 
               React.createElement(SettingsDropdown, {mozLoop: this.props.mozLoop})
--- a/browser/components/loop/content/js/panel.jsx
+++ b/browser/components/loop/content/js/panel.jsx
@@ -663,19 +663,17 @@ loop.panel = (function(_, mozL10n) {
    * Room list.
    */
   var RoomList = React.createClass({
     mixins: [Backbone.Events, sharedMixins.WindowCloseMixin],
 
     propTypes: {
       dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
       mozLoop: React.PropTypes.object.isRequired,
-      store: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired,
-      // Used for room creation, associated with room owner.
-      userProfile: userProfileValidator
+      store: React.PropTypes.instanceOf(loop.store.RoomStore).isRequired
     },
 
     getInitialState: function() {
       return this.props.store.getStoreState();
     },
 
     componentDidMount: function() {
       this.listenTo(this.props.store, "change", this._onStoreStateChanged);
@@ -698,21 +696,16 @@ loop.panel = (function(_, mozL10n) {
         this.closeWindow();
       }
     },
 
     _onStoreStateChanged: function() {
       this.setState(this.props.store.getStoreState());
     },
 
-    _getUserDisplayName: function() {
-      return this.props.userProfile && this.props.userProfile.email ||
-        mozL10n.get("display_name_guest");
-    },
-
     /**
      * Let the user know we're loading rooms
      * @returns {Object} React render
      */
     _renderLoadingRoomsView: function() {
       return (
         <div className="room-list">
           <div className="room-list-loading">
@@ -741,18 +734,17 @@ loop.panel = (function(_, mozL10n) {
       );
     },
 
     _renderNewRoomButton: function() {
       return (
         <NewRoomView dispatcher={this.props.dispatcher}
           mozLoop={this.props.mozLoop}
           pendingOperation={this.state.pendingCreation ||
-                            this.state.pendingInitialRetrieval}
-          userDisplayName={this._getUserDisplayName()} />
+                            this.state.pendingInitialRetrieval} />
       );
     },
 
     render: function() {
       if (this.state.error) {
         // XXX Better end user reporting of errors.
         console.error("RoomList error", this.state.error);
       }
@@ -787,18 +779,17 @@ loop.panel = (function(_, mozL10n) {
 
   /**
    * Used for creating a new room with or without context.
    */
   var NewRoomView = React.createClass({
     propTypes: {
       dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
       mozLoop: React.PropTypes.object.isRequired,
-      pendingOperation: React.PropTypes.bool.isRequired,
-      userDisplayName: React.PropTypes.string.isRequired
+      pendingOperation: React.PropTypes.bool.isRequired
     },
 
     mixins: [
       sharedMixins.DocumentVisibilityMixin,
       React.addons.PureRenderMixin
     ],
 
     getInitialState: function() {
@@ -997,18 +988,17 @@ loop.panel = (function(_, mozL10n) {
 
       return (
         <div className="panel-content">
           <NotificationListView
             clearOnDocumentHidden={true}
             notifications={this.props.notifications} />
             <RoomList dispatcher={this.props.dispatcher}
                       mozLoop={this.props.mozLoop}
-                      store={this.props.roomStore}
-                      userProfile={this.state.userProfile} />
+                      store={this.props.roomStore} />
           <div className="footer">
             <div className="user-details">
               <AvailabilityDropdown />
             </div>
             <div className="signin-details">
               <AccountLink fxAEnabled={this.props.mozLoop.fxAEnabled}
                            userProfile={this.state.userProfile}/>
               <SettingsDropdown mozLoop={this.props.mozLoop}/>