diff --git a/browser/components/loop/content/js/panel.js b/browser/components/loop/content/js/panel.js index d34fbdacd63c..251964a33c6a 100644 --- a/browser/components/loop/content/js/panel.js +++ b/browser/components/loop/content/js/panel.js @@ -537,6 +537,12 @@ loop.panel = (function(_, mozL10n) { return {edit: false, text: this.props.text}; }, + componentWillReceiveProps: function(nextProps) { + if (nextProps.text !== this.props.text) { + this.setState({text: nextProps.text}); + } + }, + handleTextClick: function(event) { event.stopPropagation(); event.preventDefault(); diff --git a/browser/components/loop/content/js/panel.jsx b/browser/components/loop/content/js/panel.jsx index aea56f241da2..0af032c7824c 100644 --- a/browser/components/loop/content/js/panel.jsx +++ b/browser/components/loop/content/js/panel.jsx @@ -537,6 +537,12 @@ loop.panel = (function(_, mozL10n) { return {edit: false, text: this.props.text}; }, + componentWillReceiveProps: function(nextProps) { + if (nextProps.text !== this.props.text) { + this.setState({text: nextProps.text}); + } + }, + handleTextClick: function(event) { event.stopPropagation(); event.preventDefault(); diff --git a/browser/components/loop/content/shared/js/activeRoomStore.js b/browser/components/loop/content/shared/js/activeRoomStore.js index 50fd401824eb..abf819bcd66f 100644 --- a/browser/components/loop/content/shared/js/activeRoomStore.js +++ b/browser/components/loop/content/shared/js/activeRoomStore.js @@ -391,8 +391,7 @@ loop.store.ActiveRoomStore = (function() { this._leaveRoom(ROOM_STATES.CLOSING); // If we're closing the window, we can stop listening to updates. - this._mozLoop.rooms.off("update:" + this.getStoreState().roomToken, - this._handleRoomUpdate.bind(this)); + this._mozLoop.rooms.off("update:" + this.getStoreState().roomToken); }, /** diff --git a/browser/components/loop/test/desktop-local/panel_test.js b/browser/components/loop/test/desktop-local/panel_test.js index c5c2bab4e15d..b3e0477ce4ef 100644 --- a/browser/components/loop/test/desktop-local/panel_test.js +++ b/browser/components/loop/test/desktop-local/panel_test.js @@ -857,6 +857,25 @@ describe("loop.panel", function() { new sharedActions.OpenRoom({roomToken: roomData.roomToken})); }); }); + + describe("Room name updated", function() { + it("should update room name", function() { + var roomEntry = mountRoomEntry({ + dispatcher: dispatcher, + room: new loop.store.Room(roomData) + }); + var updatedRoom = new loop.store.Room(_.extend({}, roomData, { + roomName: "New room name", + ctime: new Date().getTime() + })); + + roomEntry.setProps({room: updatedRoom}); + + expect( + roomEntry.getDOMNode().querySelector(".edit-in-place").textContent) + .eql("New room name"); + }); + }); }); describe("loop.panel.RoomList", function() {