mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Follow-up to bug 1079225 - Fix formatting of the waiting for media message in Loop rooms, and ensure feedback can be given for multiple conversations in a row. r=abr
This commit is contained in:
parent
e43b3f25ef
commit
34e32086ea
@ -331,9 +331,10 @@ loop.shared.actions = (function() {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Resets current room.
|
||||
* Used to indicate that the feedback cycle is completed and the countdown
|
||||
* finished.
|
||||
*/
|
||||
ResetRoom: Action.define("resetRoom", {
|
||||
FeedbackComplete: Action.define("feedbackComplete", {
|
||||
}),
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ loop.store.ActiveRoomStore = (function() {
|
||||
"remotePeerConnected",
|
||||
"windowUnload",
|
||||
"leaveRoom",
|
||||
"resetRoom"
|
||||
"feedbackComplete"
|
||||
]);
|
||||
},
|
||||
|
||||
@ -453,9 +453,11 @@ loop.store.ActiveRoomStore = (function() {
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets current room.
|
||||
* When feedback is complete, we reset the room to the initial state.
|
||||
*/
|
||||
resetRoom: function() {
|
||||
feedbackComplete: function() {
|
||||
// Note, that we want some values, such as the windowId, so we don't
|
||||
// do a full reset here.
|
||||
this.setStoreState(this.getInitialStoreState());
|
||||
}
|
||||
});
|
||||
|
@ -37,7 +37,8 @@ loop.store.FeedbackStore = (function() {
|
||||
actions: [
|
||||
"requireFeedbackDetails",
|
||||
"sendFeedback",
|
||||
"sendFeedbackError"
|
||||
"sendFeedbackError",
|
||||
"feedbackComplete"
|
||||
],
|
||||
|
||||
initialize: function(options) {
|
||||
@ -91,6 +92,14 @@ loop.store.FeedbackStore = (function() {
|
||||
feedbackState: FEEDBACK_STATES.FAILED,
|
||||
error: actionData.error
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the store to its initial state as feedback has been completed,
|
||||
* i.e. ready for the next round of feedback.
|
||||
*/
|
||||
feedbackComplete: function() {
|
||||
this.resetStoreState();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -54,6 +54,17 @@ loop.store.createStore = (function() {
|
||||
this.trigger("change:" + key);
|
||||
}
|
||||
this.trigger("change");
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the store state to the initially defined state.
|
||||
*/
|
||||
resetStoreState: function() {
|
||||
if (typeof this.getInitialStoreState === "function") {
|
||||
this._storeState = this.getInitialStoreState();
|
||||
} else {
|
||||
this._storeState = {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
onFeedbackSent: function() {
|
||||
// We pass a tick to prevent React warnings regarding nested updates.
|
||||
setTimeout(function() {
|
||||
this.props.activeRoomStore.dispatchAction(new sharedActions.ResetRoom());
|
||||
this.props.activeRoomStore.dispatchAction(new sharedActions.FeedbackComplete());
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
@ -85,8 +85,10 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
{clientShortname: mozL10n.get("clientShortname2")});
|
||||
// XXX Bug 1047040 will add images to help prompt the user.
|
||||
return (
|
||||
React.DOM.p({className: "prompt-media-message"},
|
||||
msg
|
||||
React.DOM.div({className: "room-inner-info-area"},
|
||||
React.DOM.p({className: "prompt-media-message"},
|
||||
msg
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
onFeedbackSent: function() {
|
||||
// We pass a tick to prevent React warnings regarding nested updates.
|
||||
setTimeout(function() {
|
||||
this.props.activeRoomStore.dispatchAction(new sharedActions.ResetRoom());
|
||||
this.props.activeRoomStore.dispatchAction(new sharedActions.FeedbackComplete());
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
@ -85,9 +85,11 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
{clientShortname: mozL10n.get("clientShortname2")});
|
||||
// XXX Bug 1047040 will add images to help prompt the user.
|
||||
return (
|
||||
<p className="prompt-media-message">
|
||||
{msg}
|
||||
</p>
|
||||
<div className="room-inner-info-area">
|
||||
<p className="prompt-media-message">
|
||||
{msg}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.JOINED:
|
||||
|
@ -690,9 +690,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
return nextState.callStatus !== this.state.callStatus;
|
||||
},
|
||||
|
||||
callStatusSwitcher: function(status) {
|
||||
resetCallStatus: function() {
|
||||
this.props.feedbackStore.dispatchAction(new sharedActions.FeedbackComplete());
|
||||
return function() {
|
||||
this.setState({callStatus: status});
|
||||
this.setState({callStatus: "start"});
|
||||
}.bind(this);
|
||||
},
|
||||
|
||||
@ -744,7 +745,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
sdk: this.props.sdk,
|
||||
conversation: this.props.conversation,
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
onAfterFeedbackReceived: this.callStatusSwitcher("start")}
|
||||
onAfterFeedbackReceived: this.resetCallStatus()}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -690,9 +690,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
return nextState.callStatus !== this.state.callStatus;
|
||||
},
|
||||
|
||||
callStatusSwitcher: function(status) {
|
||||
resetCallStatus: function() {
|
||||
this.props.feedbackStore.dispatchAction(new sharedActions.FeedbackComplete());
|
||||
return function() {
|
||||
this.setState({callStatus: status});
|
||||
this.setState({callStatus: "start"});
|
||||
}.bind(this);
|
||||
},
|
||||
|
||||
@ -744,7 +745,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
sdk={this.props.sdk}
|
||||
conversation={this.props.conversation}
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
onAfterFeedbackReceived={this.callStatusSwitcher("start")}
|
||||
onAfterFeedbackReceived={this.resetCallStatus()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#resetRoom", function() {
|
||||
describe("#feedbackComplete", function() {
|
||||
it("should reset the room store state", function() {
|
||||
var initialState = store.getInitialStoreState();
|
||||
store.setStoreState({
|
||||
@ -274,7 +274,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
failureReason: "foo"
|
||||
});
|
||||
|
||||
store.resetRoom(new sharedActions.ResetRoom());
|
||||
store.feedbackComplete(new sharedActions.FeedbackComplete());
|
||||
|
||||
expect(store.getStoreState()).eql(initialState);
|
||||
});
|
||||
|
@ -105,4 +105,16 @@ describe("loop.store.FeedbackStore", function () {
|
||||
store.sendFeedback(new sharedActions.SendFeedback(sadFeedbackData));
|
||||
});
|
||||
});
|
||||
|
||||
describe("feedbackComplete", function() {
|
||||
it("should reset the store state", function() {
|
||||
store.setStoreState({feedbackState: FEEDBACK_STATES.SENT});
|
||||
|
||||
store.feedbackComplete();
|
||||
|
||||
expect(store.getStoreState()).eql({
|
||||
feedbackState: FEEDBACK_STATES.INIT
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -291,21 +291,25 @@ describe("loop.standaloneRoomViews", function() {
|
||||
});
|
||||
|
||||
describe("Feedback", function() {
|
||||
beforeEach(function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
|
||||
});
|
||||
|
||||
it("should display a feedback form when the user leaves the room",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
|
||||
|
||||
expect(view.getDOMNode().querySelector(".faces")).not.eql(null);
|
||||
});
|
||||
|
||||
it("should reinit the view after feedback is sent", function() {
|
||||
feedbackStore.setStoreState({feedbackState: FEEDBACK_STATES.SENT});
|
||||
it("should dispatch a `FeedbackComplete` action after feedback is sent",
|
||||
function() {
|
||||
feedbackStore.setStoreState({feedbackState: FEEDBACK_STATES.SENT});
|
||||
|
||||
sandbox.clock.tick(
|
||||
loop.shared.views.WINDOW_AUTOCLOSE_TIMEOUT_IN_SECONDS * 1000);
|
||||
sandbox.clock.tick(
|
||||
loop.shared.views.WINDOW_AUTOCLOSE_TIMEOUT_IN_SECONDS * 1000 + 1000);
|
||||
|
||||
expect(view.getDOMNode().querySelector(".btn-join")).not.eql(null);
|
||||
});
|
||||
sinon.assert.calledOnce(dispatch);
|
||||
sinon.assert.calledWithExactly(dispatch, new sharedActions.FeedbackComplete());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user