Remove all data stores! Move to maps

This commit is contained in:
Amish Shah
2016-08-19 22:34:59 +01:00
parent 82ab92ca2a
commit 8d5d90e222
17 changed files with 81 additions and 111 deletions

View File

@@ -4,7 +4,7 @@ class ChannelCreateAction extends Action {
handle(data) {
const client = this.client;
const channel = client.store.newChannel(data);
const channel = client.dataManager.newChannel(data);
return {
channel,

View File

@@ -13,7 +13,7 @@ class ChannelDeleteAction extends Action {
let channel = client.channels.get(data.id);
if (channel) {
client.store.killChannel(channel);
client.dataManager.killChannel(channel);
this.deleted[channel.id] = channel;
this.scheduleForDeletion(channel.id);
} else if (this.deleted[data.id]) {

View File

@@ -7,22 +7,22 @@ class UserUpdateAction extends Action {
handle(data) {
const client = this.client;
if (client.store.user) {
if (client.store.user.equals(data)) {
if (client.user) {
if (client.user.equals(data)) {
return {
old: client.store.user,
updated: client.store.user,
old: client.user,
updated: client.user,
};
}
const oldUser = cloneObject(client.store.user);
client.store.user.setup(data);
const oldUser = cloneObject(client.user);
client.user.setup(data);
client.emit(Constants.Events.USER_UPDATE, oldUser, client.store.user);
client.emit(Constants.Events.USER_UPDATE, oldUser, client.user);
return {
old: oldUser,
updated: client.store.user,
updated: client.user,
};
}