mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1227105 - Add cryptoKey to storeState for use in retry action and fix for TypeError in standaloneRoomViews to make retrying work better in more instances. r=Standard8
This commit is contained in:
parent
943c4d11f0
commit
e110224e1d
@ -358,6 +358,7 @@ loop.store.ActiveRoomStore = (function() {
|
||||
this.setStoreState({
|
||||
roomState: ROOM_STATES.GATHER,
|
||||
roomToken: actionData.token,
|
||||
roomCryptoKey: actionData.cryptoKey,
|
||||
standalone: true
|
||||
});
|
||||
|
||||
|
@ -449,15 +449,19 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
componentWillUpdate: function(nextProps, nextState) {
|
||||
if (this.state.roomState !== ROOM_STATES.READY &&
|
||||
nextState.roomState === ROOM_STATES.READY) {
|
||||
var roomName = nextState.roomName ||
|
||||
this.state.roomName ||
|
||||
this.state.roomContextUrls[0].description ||
|
||||
this.state.roomContextUrls[0].location;
|
||||
|
||||
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
|
||||
roomName: roomName,
|
||||
clientShortname: mozL10n.get("clientShortname2")
|
||||
}));
|
||||
var roomName = nextState.roomName;
|
||||
if (!roomName && nextState.roomContextUrls) {
|
||||
roomName = nextState.roomContextUrls[0].description ||
|
||||
nextState.roomContextUrls[0].location;
|
||||
}
|
||||
if (!roomName) {
|
||||
this.setTitle(mozL10n.get("clientShortname2"));
|
||||
} else {
|
||||
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
|
||||
roomName: roomName,
|
||||
clientShortname: mozL10n.get("clientShortname2")
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&
|
||||
|
@ -449,15 +449,19 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
componentWillUpdate: function(nextProps, nextState) {
|
||||
if (this.state.roomState !== ROOM_STATES.READY &&
|
||||
nextState.roomState === ROOM_STATES.READY) {
|
||||
var roomName = nextState.roomName ||
|
||||
this.state.roomName ||
|
||||
this.state.roomContextUrls[0].description ||
|
||||
this.state.roomContextUrls[0].location;
|
||||
|
||||
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
|
||||
roomName: roomName,
|
||||
clientShortname: mozL10n.get("clientShortname2")
|
||||
}));
|
||||
var roomName = nextState.roomName;
|
||||
if (!roomName && nextState.roomContextUrls) {
|
||||
roomName = nextState.roomContextUrls[0].description ||
|
||||
nextState.roomContextUrls[0].location;
|
||||
}
|
||||
if (!roomName) {
|
||||
this.setTitle(mozL10n.get("clientShortname2"));
|
||||
} else {
|
||||
this.setTitle(mozL10n.get("standalone_title_with_room_name", {
|
||||
roomName: roomName,
|
||||
clientShortname: mozL10n.get("clientShortname2")
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.roomState !== ROOM_STATES.MEDIA_WAIT &&
|
||||
|
@ -457,6 +457,29 @@ describe("loop.standaloneRoomViews", function() {
|
||||
expect(fakeWindow.document.title).to.equal("fakeName — clientShortname2");
|
||||
});
|
||||
|
||||
it("should set document.title to brand name when state is READY and roomName is undefined", function() {
|
||||
activeRoomStore.setStoreState({ roomState: ROOM_STATES.INIT });
|
||||
view = mountTestComponent();
|
||||
activeRoomStore.setStoreState({ roomName: undefined, roomState: ROOM_STATES.READY });
|
||||
|
||||
expect(fakeWindow.document.title).to.equal("clientShortname2");
|
||||
});
|
||||
|
||||
it("should set document.title to roomContectUrls[0] and brand name when state is READY and roomContextUrls is present", function() {
|
||||
activeRoomStore.setStoreState({ roomState: ROOM_STATES.INIT });
|
||||
view = mountTestComponent();
|
||||
activeRoomStore.setStoreState({
|
||||
roomName: undefined,
|
||||
roomContextUrls: [{
|
||||
description: "fakeStartPage",
|
||||
location: null
|
||||
}],
|
||||
roomState: ROOM_STATES.READY
|
||||
});
|
||||
|
||||
expect(fakeWindow.document.title).to.equal("fakeStartPage — clientShortname2");
|
||||
});
|
||||
|
||||
it("should dispatch a `SetupStreamElements` action when the MEDIA_WAIT state " +
|
||||
"is entered", function() {
|
||||
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
|
||||
|
Loading…
x
Reference in New Issue
Block a user