mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1109849 - Bypass the feedback form if no-one has entered the room yet. r=nperriault
This commit is contained in:
parent
b1c1b6380c
commit
31e51a9f4a
@ -300,10 +300,16 @@ loop.roomViews = (function(mozL10n) {
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.ENDED: {
|
||||
return sharedViews.FeedbackView({
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
onAfterFeedbackReceived: this.closeWindow}
|
||||
);
|
||||
if (this.state.used)
|
||||
return sharedViews.FeedbackView({
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
onAfterFeedbackReceived: this.closeWindow}
|
||||
);
|
||||
|
||||
// In case the room was not used (no one was here), we
|
||||
// bypass the feedback form.
|
||||
this.closeWindow();
|
||||
return null;
|
||||
}
|
||||
default: {
|
||||
return (
|
||||
|
@ -300,10 +300,16 @@ loop.roomViews = (function(mozL10n) {
|
||||
/>;
|
||||
}
|
||||
case ROOM_STATES.ENDED: {
|
||||
return <sharedViews.FeedbackView
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
onAfterFeedbackReceived={this.closeWindow}
|
||||
/>;
|
||||
if (this.state.used)
|
||||
return <sharedViews.FeedbackView
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
onAfterFeedbackReceived={this.closeWindow}
|
||||
/>;
|
||||
|
||||
// In case the room was not used (no one was here), we
|
||||
// bypass the feedback form.
|
||||
this.closeWindow();
|
||||
return null;
|
||||
}
|
||||
default: {
|
||||
return (
|
||||
|
@ -67,7 +67,12 @@ loop.store.ActiveRoomStore = (function() {
|
||||
roomState: ROOM_STATES.INIT,
|
||||
audioMuted: false,
|
||||
videoMuted: false,
|
||||
failureReason: undefined
|
||||
failureReason: undefined,
|
||||
// Tracks if the room has been used during this
|
||||
// session. 'Used' means at least one call has been placed
|
||||
// with it. Entering and leaving the room without seeing
|
||||
// anyone is not considered as 'used'
|
||||
used: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -361,7 +366,10 @@ loop.store.ActiveRoomStore = (function() {
|
||||
* Handles recording when a remote peer has connected to the servers.
|
||||
*/
|
||||
remotePeerConnected: function() {
|
||||
this.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
|
||||
this.setStoreState({
|
||||
roomState: ROOM_STATES.HAS_PARTICIPANTS,
|
||||
used: true
|
||||
});
|
||||
|
||||
// We've connected with a third-party, therefore stop displaying the ToS etc.
|
||||
this._mozLoop.setLoopPref("seenToS", "seen");
|
||||
|
@ -115,14 +115,20 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.ENDED: {
|
||||
return (
|
||||
React.DOM.div({className: "ended-conversation"},
|
||||
sharedViews.FeedbackView({
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
onAfterFeedbackReceived: this.onFeedbackSent}
|
||||
if (this.props.roomUsed)
|
||||
return (
|
||||
React.DOM.div({className: "ended-conversation"},
|
||||
sharedViews.FeedbackView({
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
onAfterFeedbackReceived: this.onFeedbackSent}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// In case the room was not used (no one was here), we
|
||||
// bypass the feedback form.
|
||||
this.onFeedbackSent();
|
||||
return null;
|
||||
}
|
||||
case ROOM_STATES.FAILED: {
|
||||
return (
|
||||
@ -362,7 +368,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
joinRoom: this.joinRoom,
|
||||
helper: this.props.helper,
|
||||
activeRoomStore: this.props.activeRoomStore,
|
||||
feedbackStore: this.props.feedbackStore}),
|
||||
feedbackStore: this.props.feedbackStore,
|
||||
roomUsed: this.state.used}),
|
||||
React.DOM.div({className: "video-layout-wrapper"},
|
||||
React.DOM.div({className: "conversation room-conversation"},
|
||||
React.DOM.h2({className: "room-name"}, this.state.roomName),
|
||||
|
@ -115,14 +115,20 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.ENDED: {
|
||||
return (
|
||||
<div className="ended-conversation">
|
||||
<sharedViews.FeedbackView
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
onAfterFeedbackReceived={this.onFeedbackSent}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
if (this.props.roomUsed)
|
||||
return (
|
||||
<div className="ended-conversation">
|
||||
<sharedViews.FeedbackView
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
onAfterFeedbackReceived={this.onFeedbackSent}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
// In case the room was not used (no one was here), we
|
||||
// bypass the feedback form.
|
||||
this.onFeedbackSent();
|
||||
return null;
|
||||
}
|
||||
case ROOM_STATES.FAILED: {
|
||||
return (
|
||||
@ -362,7 +368,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
joinRoom={this.joinRoom}
|
||||
helper={this.props.helper}
|
||||
activeRoomStore={this.props.activeRoomStore}
|
||||
feedbackStore={this.props.feedbackStore} />
|
||||
feedbackStore={this.props.feedbackStore}
|
||||
roomUsed={this.state.used} />
|
||||
<div className="video-layout-wrapper">
|
||||
<div className="conversation room-conversation">
|
||||
<h2 className="room-name">{this.state.roomName}</h2>
|
||||
|
@ -64,6 +64,7 @@ describe("loop.roomViews", function () {
|
||||
audioMuted: false,
|
||||
videoMuted: false,
|
||||
failureReason: undefined,
|
||||
used: false,
|
||||
foo: "bar"
|
||||
});
|
||||
});
|
||||
@ -355,13 +356,28 @@ describe("loop.roomViews", function () {
|
||||
|
||||
it("should render the FeedbackView if roomState is `ENDED`",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
|
||||
activeRoomStore.setStoreState({
|
||||
roomState: ROOM_STATES.ENDED,
|
||||
used: true
|
||||
});
|
||||
|
||||
view = mountTestComponent();
|
||||
|
||||
TestUtils.findRenderedComponentWithType(view,
|
||||
loop.shared.views.FeedbackView);
|
||||
});
|
||||
|
||||
it("should NOT render the FeedbackView if the room has not been used",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({
|
||||
roomState: ROOM_STATES.ENDED,
|
||||
used: false
|
||||
});
|
||||
|
||||
view = mountTestComponent();
|
||||
|
||||
expect(view.getDOMNode()).eql(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Mute", function() {
|
||||
|
@ -300,7 +300,10 @@ describe("loop.standaloneRoomViews", function() {
|
||||
|
||||
describe("Feedback", function() {
|
||||
beforeEach(function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED});
|
||||
activeRoomStore.setStoreState({
|
||||
roomState: ROOM_STATES.ENDED,
|
||||
used: true
|
||||
});
|
||||
});
|
||||
|
||||
it("should display a feedback form when the user leaves the room",
|
||||
@ -318,6 +321,13 @@ describe("loop.standaloneRoomViews", function() {
|
||||
sinon.assert.calledOnce(dispatch);
|
||||
sinon.assert.calledWithExactly(dispatch, new sharedActions.FeedbackComplete());
|
||||
});
|
||||
|
||||
it("should NOT display a feedback form if the room has not been used",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({used: false});
|
||||
expect(view.getDOMNode().querySelector(".faces")).eql(null);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Mute", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user