mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1212331 - Remove the Let's talk about context addition options from the Loop panel. r=Standard8
This commit is contained in:
parent
ce20cdeb29
commit
0a27b3ef18
@ -1735,7 +1735,6 @@ pref("loop.support_url", "https://support.mozilla.org/kb/group-conversations-fir
|
||||
pref("loop.contacts.gravatars.show", false);
|
||||
pref("loop.contacts.gravatars.promo", true);
|
||||
pref("loop.browserSharing.showInfoBar", true);
|
||||
pref("loop.contextInConversations.enabled", true);
|
||||
|
||||
pref("social.sidebar.unload_timeout_ms", 10000);
|
||||
|
||||
|
@ -208,46 +208,6 @@ body {
|
||||
border-top: 1px solid #d8d8d8;
|
||||
}
|
||||
|
||||
.new-room-view > .context-checkbox-checked {
|
||||
background-color: #dbf7ff;
|
||||
}
|
||||
|
||||
.new-room-view > .context {
|
||||
border-top: 1px solid #ebebeb;
|
||||
flex: 1;
|
||||
border-radius: 3px 3px 0 0;
|
||||
padding: 6px 15px 8px;
|
||||
}
|
||||
|
||||
.new-room-view > .context > .context-enabled {
|
||||
margin-bottom: .5rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.new-room-view > .context > .context-enabled > input {
|
||||
-moz-margin-start: 0;
|
||||
}
|
||||
|
||||
.new-room-view > .context > .checkbox-wrapper {
|
||||
height: 2rem;
|
||||
margin-bottom: .5em;
|
||||
line-height: 2rem;
|
||||
}
|
||||
|
||||
.new-room-view > .context > .checkbox-wrapper > .checkbox {
|
||||
border-color: #d8d8d8;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.new-room-view > .context > .checkbox-wrapper > .checkbox.checked {
|
||||
background-image: url("../shared/img/check.svg#check-blue");
|
||||
}
|
||||
|
||||
.new-room-view > .context > .checkbox-wrapper > label {
|
||||
color: #333;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.new-room-view > .btn {
|
||||
flex: 1;
|
||||
height: 3rem;
|
||||
|
@ -735,7 +735,6 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
checked: false,
|
||||
previewImage: "",
|
||||
description: "",
|
||||
url: ""
|
||||
@ -759,7 +758,6 @@ loop.panel = (function(_, mozL10n) {
|
||||
var description = metadata.title || metadata.description;
|
||||
var url = metadata.url;
|
||||
this.setState({
|
||||
checked: false,
|
||||
previewImage: previewImage,
|
||||
description: description,
|
||||
url: url
|
||||
@ -767,55 +765,22 @@ loop.panel = (function(_, mozL10n) {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onCheckboxChange: function(newState) {
|
||||
this.setState({checked: newState.checked});
|
||||
},
|
||||
|
||||
handleCreateButtonClick: function() {
|
||||
var createRoomAction = new sharedActions.CreateRoom({
|
||||
nameTemplate: mozL10n.get("rooms_default_room_name_template")
|
||||
});
|
||||
|
||||
if (this.state.checked) {
|
||||
createRoomAction.urls = [{
|
||||
location: this.state.url,
|
||||
description: this.state.description,
|
||||
thumbnail: this.state.previewImage
|
||||
}];
|
||||
}
|
||||
createRoomAction.urls = [{
|
||||
location: this.state.url,
|
||||
description: this.state.description,
|
||||
thumbnail: this.state.previewImage
|
||||
}];
|
||||
this.props.dispatcher.dispatch(createRoomAction);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var hostname;
|
||||
|
||||
try {
|
||||
hostname = new URL(this.state.url).hostname;
|
||||
} catch (ex) {
|
||||
// Empty catch - if there's an error, then we won't show the context.
|
||||
}
|
||||
|
||||
var contextClasses = React.addons.classSet({
|
||||
context: true,
|
||||
"context-checkbox-checked": this.state.checked,
|
||||
hide: !hostname ||
|
||||
!this.props.mozLoop.getLoopPref("contextInConversations.enabled")
|
||||
});
|
||||
|
||||
return (
|
||||
React.createElement("div", {className: "new-room-view"},
|
||||
React.createElement("div", {className: contextClasses},
|
||||
React.createElement(Checkbox, {checked: this.state.checked,
|
||||
label: mozL10n.get("context_inroom_label2"),
|
||||
onChange: this.onCheckboxChange}),
|
||||
React.createElement(sharedViews.ContextUrlView, {
|
||||
allowClick: false,
|
||||
description: this.state.description,
|
||||
showContextTitle: false,
|
||||
thumbnail: this.state.previewImage,
|
||||
url: this.state.url,
|
||||
useDesktopPaths: true})
|
||||
),
|
||||
React.createElement("button", {className: "btn btn-info new-room-button",
|
||||
disabled: this.props.pendingOperation,
|
||||
onClick: this.handleCreateButtonClick},
|
||||
|
@ -735,7 +735,6 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
checked: false,
|
||||
previewImage: "",
|
||||
description: "",
|
||||
url: ""
|
||||
@ -759,7 +758,6 @@ loop.panel = (function(_, mozL10n) {
|
||||
var description = metadata.title || metadata.description;
|
||||
var url = metadata.url;
|
||||
this.setState({
|
||||
checked: false,
|
||||
previewImage: previewImage,
|
||||
description: description,
|
||||
url: url
|
||||
@ -767,55 +765,22 @@ loop.panel = (function(_, mozL10n) {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onCheckboxChange: function(newState) {
|
||||
this.setState({checked: newState.checked});
|
||||
},
|
||||
|
||||
handleCreateButtonClick: function() {
|
||||
var createRoomAction = new sharedActions.CreateRoom({
|
||||
nameTemplate: mozL10n.get("rooms_default_room_name_template")
|
||||
});
|
||||
|
||||
if (this.state.checked) {
|
||||
createRoomAction.urls = [{
|
||||
location: this.state.url,
|
||||
description: this.state.description,
|
||||
thumbnail: this.state.previewImage
|
||||
}];
|
||||
}
|
||||
createRoomAction.urls = [{
|
||||
location: this.state.url,
|
||||
description: this.state.description,
|
||||
thumbnail: this.state.previewImage
|
||||
}];
|
||||
this.props.dispatcher.dispatch(createRoomAction);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var hostname;
|
||||
|
||||
try {
|
||||
hostname = new URL(this.state.url).hostname;
|
||||
} catch (ex) {
|
||||
// Empty catch - if there's an error, then we won't show the context.
|
||||
}
|
||||
|
||||
var contextClasses = React.addons.classSet({
|
||||
context: true,
|
||||
"context-checkbox-checked": this.state.checked,
|
||||
hide: !hostname ||
|
||||
!this.props.mozLoop.getLoopPref("contextInConversations.enabled")
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="new-room-view">
|
||||
<div className={contextClasses}>
|
||||
<Checkbox checked={this.state.checked}
|
||||
label={mozL10n.get("context_inroom_label2")}
|
||||
onChange={this.onCheckboxChange} />
|
||||
<sharedViews.ContextUrlView
|
||||
allowClick={false}
|
||||
description={this.state.description}
|
||||
showContextTitle={false}
|
||||
thumbnail={this.state.previewImage}
|
||||
url={this.state.url}
|
||||
useDesktopPaths={true} />
|
||||
</div>
|
||||
<button className="btn btn-info new-room-button"
|
||||
disabled={this.props.pendingOperation}
|
||||
onClick={this.handleCreateButtonClick}>
|
||||
|
@ -606,7 +606,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
contextEnabled: this.props.mozLoop.getLoopPref("contextInConversations.enabled"),
|
||||
showEditContext: false
|
||||
};
|
||||
},
|
||||
@ -767,7 +766,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
};
|
||||
|
||||
var shouldRenderInvitationOverlay = this._shouldRenderInvitationOverlay();
|
||||
var shouldRenderEditContextView = this.state.contextEnabled && this.state.showEditContext;
|
||||
var shouldRenderEditContextView = this.state.showEditContext;
|
||||
var roomData = this.props.roomStore.getStoreState("activeRoom");
|
||||
|
||||
switch(this.state.roomState) {
|
||||
@ -792,7 +791,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
{
|
||||
id: "edit",
|
||||
enabled: !this.state.showEditContext,
|
||||
visible: this.state.contextEnabled,
|
||||
visible: true,
|
||||
onClick: this.handleEditContextClick
|
||||
},
|
||||
{ id: "feedback" },
|
||||
|
@ -606,7 +606,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
contextEnabled: this.props.mozLoop.getLoopPref("contextInConversations.enabled"),
|
||||
showEditContext: false
|
||||
};
|
||||
},
|
||||
@ -767,7 +766,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
};
|
||||
|
||||
var shouldRenderInvitationOverlay = this._shouldRenderInvitationOverlay();
|
||||
var shouldRenderEditContextView = this.state.contextEnabled && this.state.showEditContext;
|
||||
var shouldRenderEditContextView = this.state.showEditContext;
|
||||
var roomData = this.props.roomStore.getStoreState("activeRoom");
|
||||
|
||||
switch(this.state.roomState) {
|
||||
@ -792,7 +791,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
{
|
||||
id: "edit",
|
||||
enabled: !this.state.showEditContext,
|
||||
visible: this.state.contextEnabled,
|
||||
visible: true,
|
||||
onClick: this.handleEditContextClick
|
||||
},
|
||||
{ id: "feedback" },
|
||||
|
@ -28,8 +28,6 @@ describe("loop.conversation", function() {
|
||||
setLoopPref: setLoopPrefStub,
|
||||
getLoopPref: function(prefName) {
|
||||
switch (prefName) {
|
||||
case "contextInConversations.enabled":
|
||||
return false;
|
||||
case "debug.sdk":
|
||||
return false;
|
||||
default:
|
||||
|
@ -51,12 +51,7 @@ describe("loop.panel", function() {
|
||||
},
|
||||
setLoopPref: sandbox.stub(),
|
||||
getLoopPref: function (prefName) {
|
||||
switch (prefName) {
|
||||
case "contextInConversations.enabled":
|
||||
return true;
|
||||
default:
|
||||
return "unseen";
|
||||
}
|
||||
return "unseen";
|
||||
},
|
||||
getPluralForm: function() {
|
||||
return "fakeText";
|
||||
@ -833,19 +828,6 @@ describe("loop.panel", function() {
|
||||
}));
|
||||
}
|
||||
|
||||
it("should dispatch a CreateRoom action when clicking on the Start a " +
|
||||
"conversation button",
|
||||
function() {
|
||||
navigator.mozLoop.userProfile = {email: fakeEmail};
|
||||
var view = createTestComponent(false);
|
||||
|
||||
TestUtils.Simulate.click(view.getDOMNode().querySelector(".new-room-button"));
|
||||
|
||||
sinon.assert.calledWith(dispatch, new sharedActions.CreateRoom({
|
||||
nameTemplate: "Fake title"
|
||||
}));
|
||||
});
|
||||
|
||||
it("should dispatch a CreateRoom action with context when clicking on the " +
|
||||
"Start a conversation button", function() {
|
||||
fakeMozLoop.userProfile = {email: fakeEmail};
|
||||
@ -866,9 +848,6 @@ describe("loop.panel", function() {
|
||||
|
||||
var node = view.getDOMNode();
|
||||
|
||||
// Select the checkbox
|
||||
TestUtils.Simulate.click(node.querySelector(".checkbox-wrapper"));
|
||||
|
||||
TestUtils.Simulate.click(node.querySelector(".new-room-button"));
|
||||
|
||||
sinon.assert.calledWith(dispatch, new sharedActions.CreateRoom({
|
||||
@ -888,116 +867,6 @@ describe("loop.panel", function() {
|
||||
var buttonNode = view.getDOMNode().querySelector(".new-room-button[disabled]");
|
||||
expect(buttonNode).to.not.equal(null);
|
||||
});
|
||||
|
||||
it("should show context information when a URL is available", function() {
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "https://www.example.com",
|
||||
description: "fake description",
|
||||
previews: [""]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
// Simulate being visible
|
||||
view.onDocumentVisible();
|
||||
|
||||
var contextContent = view.getDOMNode().querySelector(".context-content");
|
||||
expect(contextContent).to.not.equal(null);
|
||||
});
|
||||
|
||||
it("should cancel the checkbox when a new URL is available", function() {
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "https://www.example.com",
|
||||
description: "fake description",
|
||||
previews: [""]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
view.setState({ checked: true });
|
||||
|
||||
// Simulate being visible
|
||||
view.onDocumentVisible();
|
||||
|
||||
expect(view.state.checked).eql(false);
|
||||
});
|
||||
|
||||
it("should show a default favicon when none is available", function() {
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "https://www.example.com",
|
||||
description: "fake description",
|
||||
previews: [""]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
// Simulate being visible
|
||||
view.onDocumentVisible();
|
||||
|
||||
var previewImage = view.getDOMNode().querySelector(".context-preview");
|
||||
expect(previewImage.src).to.match(/loop\/shared\/img\/icons-16x16.svg#globe$/);
|
||||
});
|
||||
|
||||
it("should not show context information when a URL is unavailable", function() {
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "",
|
||||
description: "fake description",
|
||||
previews: [""]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
view.onDocumentVisible();
|
||||
|
||||
var contextInfo = view.getDOMNode().querySelector(".context");
|
||||
expect(contextInfo.classList.contains("hide")).to.equal(true);
|
||||
});
|
||||
|
||||
it("should show only the hostname of the url", function() {
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "https://www.example.com:1234",
|
||||
description: "fake description",
|
||||
previews: [""]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
// Simulate being visible
|
||||
view.onDocumentVisible();
|
||||
|
||||
var contextHostname = view.getDOMNode().querySelector(".context-url");
|
||||
expect(contextHostname.textContent).eql("www.example.com");
|
||||
});
|
||||
|
||||
it("should show the favicon when available", function() {
|
||||
var favicon = "data:image/x-icon;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
||||
fakeMozLoop.getSelectedTabMetadata = function (callback) {
|
||||
callback({
|
||||
url: "https://www.example.com:1234",
|
||||
description: "fake description",
|
||||
favicon: favicon,
|
||||
previews: ["foo.gif"]
|
||||
});
|
||||
};
|
||||
|
||||
var view = createTestComponent(false);
|
||||
|
||||
// Simulate being visible.
|
||||
view.onDocumentVisible();
|
||||
|
||||
var contextPreview = view.getDOMNode().querySelector(".context-preview");
|
||||
expect(contextPreview.src).eql(favicon);
|
||||
});
|
||||
});
|
||||
|
||||
describe("loop.panel.SignInRequestView", function() {
|
||||
|
@ -215,7 +215,6 @@ var fakeFewerContacts = fakeManyContacts.slice(0, 4);
|
||||
// Ensure we skip FTE completely.
|
||||
case "gettingStarted.seen":
|
||||
case "contacts.gravatars.promo":
|
||||
case "contextInConversations.enabled":
|
||||
return true;
|
||||
case "contacts.gravatars.show":
|
||||
return false;
|
||||
|
@ -724,20 +724,6 @@
|
||||
)
|
||||
),
|
||||
|
||||
React.createElement(FramedExample, {cssClass: "fx-embedded-panel",
|
||||
dashed: true,
|
||||
height: 410,
|
||||
summary: "Room list (No Context)",
|
||||
width: 330},
|
||||
React.createElement("div", {className: "panel"},
|
||||
React.createElement(PanelView, {client: mockClient,
|
||||
dispatcher: dispatcher,
|
||||
mozLoop: mockMozLoopLoggedInNoContext,
|
||||
notifications: notifications,
|
||||
roomStore: roomStore})
|
||||
)
|
||||
),
|
||||
|
||||
React.createElement(FramedExample, {cssClass: "fx-embedded-panel",
|
||||
dashed: true,
|
||||
height: 410,
|
||||
@ -752,20 +738,6 @@
|
||||
)
|
||||
),
|
||||
|
||||
React.createElement(FramedExample, {cssClass: "fx-embedded-panel",
|
||||
dashed: true,
|
||||
height: 410,
|
||||
summary: "Room list (no rooms and no context)",
|
||||
width: 330},
|
||||
React.createElement("div", {className: "panel"},
|
||||
React.createElement(PanelView, {client: mockClient,
|
||||
dispatcher: dispatcher,
|
||||
mozLoop: mockMozLoopNoRoomsNoContext,
|
||||
notifications: notifications,
|
||||
roomStore: roomStoreNoRooms})
|
||||
)
|
||||
),
|
||||
|
||||
React.createElement(FramedExample, {cssClass: "fx-embedded-panel",
|
||||
dashed: true,
|
||||
height: 410,
|
||||
|
@ -724,20 +724,6 @@
|
||||
</div>
|
||||
</FramedExample>
|
||||
|
||||
<FramedExample cssClass="fx-embedded-panel"
|
||||
dashed={true}
|
||||
height={410}
|
||||
summary="Room list (No Context)"
|
||||
width={330}>
|
||||
<div className="panel">
|
||||
<PanelView client={mockClient}
|
||||
dispatcher={dispatcher}
|
||||
mozLoop={mockMozLoopLoggedInNoContext}
|
||||
notifications={notifications}
|
||||
roomStore={roomStore} />
|
||||
</div>
|
||||
</FramedExample>
|
||||
|
||||
<FramedExample cssClass="fx-embedded-panel"
|
||||
dashed={true}
|
||||
height={410}
|
||||
@ -752,20 +738,6 @@
|
||||
</div>
|
||||
</FramedExample>
|
||||
|
||||
<FramedExample cssClass="fx-embedded-panel"
|
||||
dashed={true}
|
||||
height={410}
|
||||
summary="Room list (no rooms and no context)"
|
||||
width={330}>
|
||||
<div className="panel">
|
||||
<PanelView client={mockClient}
|
||||
dispatcher={dispatcher}
|
||||
mozLoop={mockMozLoopNoRoomsNoContext}
|
||||
notifications={notifications}
|
||||
roomStore={roomStoreNoRooms} />
|
||||
</div>
|
||||
</FramedExample>
|
||||
|
||||
<FramedExample cssClass="fx-embedded-panel"
|
||||
dashed={true}
|
||||
height={410}
|
||||
|
Loading…
Reference in New Issue
Block a user