Bug 1157646 - Stop passing the roomOwner parameter around everywhere in Loop's rooms. r=mikedeboer

This commit is contained in:
Mark Banner 2015-08-27 12:10:47 +01:00
Родитель 197c1b99e8
Коммит 0f48524bec
10 изменённых файлов: 4 добавлений и 41 удалений

Просмотреть файл

@ -462,7 +462,6 @@ loop.shared.actions = (function() {
// roomContextUrls: Array - Optional. // roomContextUrls: Array - Optional.
// roomDescription: String - Optional. // roomDescription: String - Optional.
// roomName: String - Optional. // roomName: String - Optional.
roomOwner: String,
roomToken: String, roomToken: String,
roomUrl: String, roomUrl: String,
socialShareProviders: Array socialShareProviders: Array
@ -477,7 +476,6 @@ loop.shared.actions = (function() {
UpdateRoomInfo: Action.define("updateRoomInfo", { UpdateRoomInfo: Action.define("updateRoomInfo", {
// description: String - Optional. // description: String - Optional.
// roomName: String - Optional. // roomName: String - Optional.
roomOwner: String,
roomUrl: String roomUrl: String
// urls: Array - Optional. // urls: Array - Optional.
// See https://wiki.mozilla.org/Loop/Architecture/Context#Format_of_context.value // See https://wiki.mozilla.org/Loop/Architecture/Context#Format_of_context.value

Просмотреть файл

@ -273,7 +273,6 @@ loop.store.ActiveRoomStore = (function() {
roomContextUrls: roomData.decryptedContext.urls, roomContextUrls: roomData.decryptedContext.urls,
roomDescription: roomData.decryptedContext.description, roomDescription: roomData.decryptedContext.description,
roomName: roomData.decryptedContext.roomName, roomName: roomData.decryptedContext.roomName,
roomOwner: roomData.roomOwner,
roomUrl: roomData.roomUrl, roomUrl: roomData.roomUrl,
socialShareProviders: this._mozLoop.getSocialShareProviders() socialShareProviders: this._mozLoop.getSocialShareProviders()
})); }));
@ -325,7 +324,6 @@ loop.store.ActiveRoomStore = (function() {
} }
var roomInfoData = new sharedActions.UpdateRoomInfo({ var roomInfoData = new sharedActions.UpdateRoomInfo({
roomOwner: result.roomOwner,
roomUrl: result.roomUrl roomUrl: result.roomUrl
}); });
@ -396,7 +394,6 @@ loop.store.ActiveRoomStore = (function() {
roomContextUrls: actionData.roomContextUrls, roomContextUrls: actionData.roomContextUrls,
roomDescription: actionData.roomDescription, roomDescription: actionData.roomDescription,
roomName: actionData.roomName, roomName: actionData.roomName,
roomOwner: actionData.roomOwner,
roomState: ROOM_STATES.READY, roomState: ROOM_STATES.READY,
roomToken: actionData.roomToken, roomToken: actionData.roomToken,
roomUrl: actionData.roomUrl, roomUrl: actionData.roomUrl,
@ -420,7 +417,6 @@ loop.store.ActiveRoomStore = (function() {
*/ */
updateRoomInfo: function(actionData) { updateRoomInfo: function(actionData) {
var newState = { var newState = {
roomOwner: actionData.roomOwner,
roomUrl: actionData.roomUrl roomUrl: actionData.roomUrl
}; };
// Iterate over the optional fields that _may_ be present on the actionData // Iterate over the optional fields that _may_ be present on the actionData
@ -456,7 +452,6 @@ loop.store.ActiveRoomStore = (function() {
urls: roomData.decryptedContext.urls, urls: roomData.decryptedContext.urls,
description: roomData.decryptedContext.description, description: roomData.decryptedContext.description,
roomName: roomData.decryptedContext.roomName, roomName: roomData.decryptedContext.roomName,
roomOwner: roomData.roomOwner,
roomUrl: roomData.roomUrl roomUrl: roomData.roomUrl
})); }));
}, },

Просмотреть файл

@ -91,7 +91,6 @@ loop.StandaloneMozLoop = (function(mozL10n) {
try { try {
// We currently only require things we need rather than everything possible. // We currently only require things we need rather than everything possible.
callback(null, validate(responseData, { callback(null, validate(responseData, {
roomOwner: String,
roomUrl: String roomUrl: String
})); }));
} catch (err) { } catch (err) {

Просмотреть файл

@ -310,7 +310,6 @@ describe("loop.store.ActiveRoomStore", function () {
decryptedContext: { decryptedContext: {
roomName: "Monkeys" roomName: "Monkeys"
}, },
roomOwner: "Alfred",
roomUrl: "http://invalid" roomUrl: "http://invalid"
}; };
@ -353,7 +352,6 @@ describe("loop.store.ActiveRoomStore", function () {
roomDescription: undefined, roomDescription: undefined,
roomToken: fakeToken, roomToken: fakeToken,
roomName: fakeRoomData.decryptedContext.roomName, roomName: fakeRoomData.decryptedContext.roomName,
roomOwner: fakeRoomData.roomOwner,
roomUrl: fakeRoomData.roomUrl, roomUrl: fakeRoomData.roomUrl,
socialShareProviders: [] socialShareProviders: []
})); }));
@ -426,7 +424,6 @@ describe("loop.store.ActiveRoomStore", function () {
it("should dispatch an UpdateRoomInfo message with 'no data' failure if neither roomName nor context are supplied", function() { it("should dispatch an UpdateRoomInfo message with 'no data' failure if neither roomName nor context are supplied", function() {
fakeMozLoop.rooms.get.callsArgWith(1, null, { fakeMozLoop.rooms.get.callsArgWith(1, null, {
roomOwner: "Dan",
roomUrl: "http://invalid" roomUrl: "http://invalid"
}); });
@ -436,7 +433,6 @@ describe("loop.store.ActiveRoomStore", function () {
sinon.assert.calledWithExactly(dispatcher.dispatch, sinon.assert.calledWithExactly(dispatcher.dispatch,
new sharedActions.UpdateRoomInfo({ new sharedActions.UpdateRoomInfo({
roomInfoFailure: ROOM_INFO_FAILURES.NO_DATA, roomInfoFailure: ROOM_INFO_FAILURES.NO_DATA,
roomOwner: "Dan",
roomState: ROOM_STATES.READY, roomState: ROOM_STATES.READY,
roomUrl: "http://invalid" roomUrl: "http://invalid"
})); }));
@ -446,8 +442,7 @@ describe("loop.store.ActiveRoomStore", function () {
it("should dispatch UpdateRoomInfo if mozLoop.rooms.get is successful", function() { it("should dispatch UpdateRoomInfo if mozLoop.rooms.get is successful", function() {
var roomDetails = { var roomDetails = {
roomName: "fakeName", roomName: "fakeName",
roomUrl: "http://invalid", roomUrl: "http://invalid"
roomOwner: "gavin"
}; };
fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails); fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails);
@ -470,12 +465,10 @@ describe("loop.store.ActiveRoomStore", function () {
context: { context: {
value: "fakeContext" value: "fakeContext"
}, },
roomUrl: "http://invalid", roomUrl: "http://invalid"
roomOwner: "Mark"
}; };
expectedDetails = { expectedDetails = {
roomUrl: "http://invalid", roomUrl: "http://invalid"
roomOwner: "Mark"
}; };
fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails); fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails);
@ -597,7 +590,6 @@ describe("loop.store.ActiveRoomStore", function () {
beforeEach(function() { beforeEach(function() {
fakeRoomInfo = { fakeRoomInfo = {
roomName: "Its a room", roomName: "Its a room",
roomOwner: "Me",
roomToken: "fakeToken", roomToken: "fakeToken",
roomUrl: "http://invalid", roomUrl: "http://invalid",
socialShareProviders: [] socialShareProviders: []
@ -615,7 +607,6 @@ describe("loop.store.ActiveRoomStore", function () {
var state = store.getStoreState(); var state = store.getStoreState();
expect(state.roomName).eql(fakeRoomInfo.roomName); expect(state.roomName).eql(fakeRoomInfo.roomName);
expect(state.roomOwner).eql(fakeRoomInfo.roomOwner);
expect(state.roomToken).eql(fakeRoomInfo.roomToken); expect(state.roomToken).eql(fakeRoomInfo.roomToken);
expect(state.roomUrl).eql(fakeRoomInfo.roomUrl); expect(state.roomUrl).eql(fakeRoomInfo.roomUrl);
expect(state.socialShareProviders).eql([]); expect(state.socialShareProviders).eql([]);
@ -628,7 +619,6 @@ describe("loop.store.ActiveRoomStore", function () {
beforeEach(function() { beforeEach(function() {
fakeRoomInfo = { fakeRoomInfo = {
roomName: "Its a room", roomName: "Its a room",
roomOwner: "Me",
roomUrl: "http://invalid", roomUrl: "http://invalid",
urls: [{ urls: [{
description: "fake site", description: "fake site",
@ -643,7 +633,6 @@ describe("loop.store.ActiveRoomStore", function () {
var state = store.getStoreState(); var state = store.getStoreState();
expect(state.roomName).eql(fakeRoomInfo.roomName); expect(state.roomName).eql(fakeRoomInfo.roomName);
expect(state.roomOwner).eql(fakeRoomInfo.roomOwner);
expect(state.roomUrl).eql(fakeRoomInfo.roomUrl); expect(state.roomUrl).eql(fakeRoomInfo.roomUrl);
expect(state.roomContextUrls).eql(fakeRoomInfo.urls); expect(state.roomContextUrls).eql(fakeRoomInfo.urls);
}); });
@ -1503,7 +1492,6 @@ describe("loop.store.ActiveRoomStore", function () {
beforeEach(function() { beforeEach(function() {
store.setupRoomInfo(new sharedActions.SetupRoomInfo({ store.setupRoomInfo(new sharedActions.SetupRoomInfo({
roomName: "Its a room", roomName: "Its a room",
roomOwner: "Me",
roomToken: "fakeToken", roomToken: "fakeToken",
roomUrl: "http://invalid", roomUrl: "http://invalid",
socialShareProviders: [] socialShareProviders: []
@ -1521,7 +1509,6 @@ describe("loop.store.ActiveRoomStore", function () {
fake: "url" fake: "url"
} }
}, },
roomOwner: "you",
roomUrl: "original" roomUrl: "original"
}; };
@ -1532,7 +1519,6 @@ describe("loop.store.ActiveRoomStore", function () {
new sharedActions.UpdateRoomInfo({ new sharedActions.UpdateRoomInfo({
description: "fakeDescription", description: "fakeDescription",
roomName: fakeRoomData.decryptedContext.roomName, roomName: fakeRoomData.decryptedContext.roomName,
roomOwner: fakeRoomData.roomOwner,
roomUrl: fakeRoomData.roomUrl, roomUrl: fakeRoomData.roomUrl,
urls: { urls: {
fake: "url" fake: "url"
@ -1549,7 +1535,6 @@ describe("loop.store.ActiveRoomStore", function () {
fake: "url" fake: "url"
} }
}, },
roomOwner: "you",
roomUrl: "original" roomUrl: "original"
}; };
@ -1564,7 +1549,6 @@ describe("loop.store.ActiveRoomStore", function () {
decryptedContext: { decryptedContext: {
roomName: "Its a room" roomName: "Its a room"
}, },
roomOwner: "Me",
roomToken: "fakeToken", roomToken: "fakeToken",
roomUrl: "http://invalid" roomUrl: "http://invalid"
}; };

Просмотреть файл

@ -156,7 +156,6 @@ describe("loop.store.TextChatStore", function () {
it("should add the room name to the list", function() { it("should add the room name to the list", function() {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "Let's share!", roomName: "Let's share!",
roomOwner: "Mark",
roomUrl: "fake" roomUrl: "fake"
})); }));
@ -173,7 +172,6 @@ describe("loop.store.TextChatStore", function () {
it("should add the context to the list", function() { it("should add the context to the list", function() {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "Let's share!", roomName: "Let's share!",
roomOwner: "Mark",
roomUrl: "fake", roomUrl: "fake",
urls: [{ urls: [{
description: "A wonderful event", description: "A wonderful event",
@ -206,7 +204,6 @@ describe("loop.store.TextChatStore", function () {
it("should not add more than one context message", function() { it("should not add more than one context message", function() {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomOwner: "Mark",
roomUrl: "fake", roomUrl: "fake",
urls: [{ urls: [{
description: "A wonderful event", description: "A wonderful event",
@ -228,7 +225,6 @@ describe("loop.store.TextChatStore", function () {
}]); }]);
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomOwner: "Mark",
roomUrl: "fake", roomUrl: "fake",
urls: [{ urls: [{
description: "A wonderful event2", description: "A wonderful event2",
@ -253,7 +249,6 @@ describe("loop.store.TextChatStore", function () {
it("should not dispatch a LoopChatMessageAppended event", function() { it("should not dispatch a LoopChatMessageAppended event", function() {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "Let's share!", roomName: "Let's share!",
roomOwner: "Mark",
roomUrl: "fake" roomUrl: "fake"
})); }));

Просмотреть файл

@ -540,7 +540,6 @@ describe("loop.shared.views.TextChatView", function () {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "A wonderful surprise!", roomName: "A wonderful surprise!",
roomOwner: "Chris",
roomUrl: "Fake" roomUrl: "Fake"
})); }));
@ -558,7 +557,6 @@ describe("loop.shared.views.TextChatView", function () {
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({ store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "A Very Long Conversation Name", roomName: "A Very Long Conversation Name",
roomOwner: "fake",
roomUrl: "http://showcase", roomUrl: "http://showcase",
urls: [{ urls: [{
description: "A wonderful page!", description: "A wonderful page!",

Просмотреть файл

@ -83,8 +83,7 @@ describe("loop.StandaloneMozLoop", function() {
var roomDetails = { var roomDetails = {
roomName: "fakeName", roomName: "fakeName",
roomUrl: "http://invalid", roomUrl: "http://invalid"
roomOwner: "gavin"
}; };
requests[0].respond(200, {"Content-Type": "application/json"}, requests[0].respond(200, {"Content-Type": "application/json"},

Просмотреть файл

@ -15,7 +15,6 @@ var fakeRooms = [
}] }]
}, },
"roomUrl": "http://localhost:3000/rooms/_nxD4V4FflQ", "roomUrl": "http://localhost:3000/rooms/_nxD4V4FflQ",
"roomOwner": "Alexis",
"maxSize": 2, "maxSize": 2,
"creationTime": 1405517546, "creationTime": 1405517546,
"ctime": 1405517546, "ctime": 1405517546,
@ -28,7 +27,6 @@ var fakeRooms = [
"roomName": "Second Room Name" "roomName": "Second Room Name"
}, },
"roomUrl": "http://localhost:3000/rooms/QzBbvGmIZWU", "roomUrl": "http://localhost:3000/rooms/QzBbvGmIZWU",
"roomOwner": "Alexis",
"maxSize": 2, "maxSize": 2,
"creationTime": 1405517546, "creationTime": 1405517546,
"ctime": 1405517546, "ctime": 1405517546,
@ -41,7 +39,6 @@ var fakeRooms = [
"roomName": "UX Discussion" "roomName": "UX Discussion"
}, },
"roomUrl": "http://localhost:3000/rooms/3jKS_Els9IU", "roomUrl": "http://localhost:3000/rooms/3jKS_Els9IU",
"roomOwner": "Alexis",
"maxSize": 2, "maxSize": 2,
"clientMaxSize": 2, "clientMaxSize": 2,
"creationTime": 1405517546, "creationTime": 1405517546,

Просмотреть файл

@ -385,7 +385,6 @@
// Update the text chat store with the room info. // Update the text chat store with the room info.
textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({ textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "A Very Long Conversation Name", roomName: "A Very Long Conversation Name",
roomOwner: "fake",
roomUrl: "http://showcase", roomUrl: "http://showcase",
urls: [{ urls: [{
description: "A wonderful page!", description: "A wonderful page!",

Просмотреть файл

@ -385,7 +385,6 @@
// Update the text chat store with the room info. // Update the text chat store with the room info.
textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({ textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({
roomName: "A Very Long Conversation Name", roomName: "A Very Long Conversation Name",
roomOwner: "fake",
roomUrl: "http://showcase", roomUrl: "http://showcase",
urls: [{ urls: [{
description: "A wonderful page!", description: "A wonderful page!",