Merge pull request #1989 from mattermost/plt-1373

PLT-1373 Renamed all functions starting with p in client channel store
Этот коммит содержится в:
Harrison Healey
2016-01-26 15:25:42 -05:00
родитель f6540c4b5e 51e6141a1e
Коммит efc4d239e1

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

@@ -36,7 +36,7 @@ class ChannelStoreClass extends EventEmitter {
this.get = this.get.bind(this); this.get = this.get.bind(this);
this.getMember = this.getMember.bind(this); this.getMember = this.getMember.bind(this);
this.getByName = this.getByName.bind(this); this.getByName = this.getByName.bind(this);
this.pSetPostMode = this.pSetPostMode.bind(this); this.setPostMode = this.setPostMode.bind(this);
this.getPostMode = this.getPostMode.bind(this); this.getPostMode = this.getPostMode.bind(this);
this.setUnreadCount = this.setUnreadCount.bind(this); this.setUnreadCount = this.setUnreadCount.bind(this);
this.setUnreadCounts = this.setUnreadCounts.bind(this); this.setUnreadCounts = this.setUnreadCounts.bind(this);
@@ -95,7 +95,7 @@ class ChannelStoreClass extends EventEmitter {
this.removeListener(LEAVE_EVENT, callback); this.removeListener(LEAVE_EVENT, callback);
} }
findFirstBy(field, value) { findFirstBy(field, value) {
var channels = this.pGetChannels(); var channels = this.getChannels();
for (var i = 0; i < channels.length; i++) { for (var i = 0; i < channels.length; i++) {
if (channels[i][field] === value) { if (channels[i][field] === value) {
return channels[i]; return channels[i];
@@ -114,13 +114,13 @@ class ChannelStoreClass extends EventEmitter {
return this.findFirstBy('name', name); return this.findFirstBy('name', name);
} }
getAll() { getAll() {
return this.pGetChannels(); return this.getChannels();
} }
getAllMembers() { getAllMembers() {
return this.pGetChannelMembers(); return this.getChannelMembers();
} }
getMoreAll() { getMoreAll() {
return this.pGetMoreChannels(); return this.getMoreChannels();
} }
setCurrentId(id) { setCurrentId(id) {
this.currentId = id; this.currentId = id;
@@ -161,9 +161,9 @@ class ChannelStoreClass extends EventEmitter {
return null; return null;
} }
setChannelMember(member) { setChannelMember(member) {
var members = this.pGetChannelMembers(); var members = this.getChannelMembers();
members[member.channel_id] = member; members[member.channel_id] = member;
this.pStoreChannelMembers(members); this.storeChannelMembers(members);
this.emitChange(); this.emitChange();
} }
getCurrentExtraInfo() { getCurrentExtraInfo() {
@@ -173,7 +173,7 @@ class ChannelStoreClass extends EventEmitter {
var extra = null; var extra = null;
if (channelId) { if (channelId) {
extra = this.pGetExtraInfos()[channelId]; extra = this.getExtraInfos()[channelId];
} }
if (extra) { if (extra) {
@@ -186,7 +186,7 @@ class ChannelStoreClass extends EventEmitter {
return extra; return extra;
} }
pStoreChannel(channel) { pStoreChannel(channel) {
var channels = this.pGetChannels(); var channels = this.getChannels();
var found; var found;
for (var i = 0; i < channels.length; i++) { for (var i = 0; i < channels.length; i++) {
@@ -206,42 +206,42 @@ class ChannelStoreClass extends EventEmitter {
} }
channels.sort(Utils.sortByDisplayName); channels.sort(Utils.sortByDisplayName);
this.pStoreChannels(channels); this.storeChannels(channels);
} }
pStoreChannels(channels) { storeChannels(channels) {
this.channels = channels; this.channels = channels;
} }
pGetChannels() { getChannels() {
return this.channels; return this.channels;
} }
pStoreChannelMember(channelMember) { pStoreChannelMember(channelMember) {
var members = this.pGetChannelMembers(); var members = this.getChannelMembers();
members[channelMember.channel_id] = channelMember; members[channelMember.channel_id] = channelMember;
this.pStoreChannelMembers(members); this.storeChannelMembers(members);
} }
pStoreChannelMembers(channelMembers) { storeChannelMembers(channelMembers) {
this.channelMembers = channelMembers; this.channelMembers = channelMembers;
} }
pGetChannelMembers() { getChannelMembers() {
return this.channelMembers; return this.channelMembers;
} }
pStoreMoreChannels(channels) { storeMoreChannels(channels) {
this.moreChannels = channels; this.moreChannels = channels;
} }
pGetMoreChannels() { getMoreChannels() {
return this.moreChannels; return this.moreChannels;
} }
pStoreExtraInfos(extraInfos) { storeExtraInfos(extraInfos) {
this.extraInfos = extraInfos; this.extraInfos = extraInfos;
} }
pGetExtraInfos() { getExtraInfos() {
return this.extraInfos; return this.extraInfos;
} }
isDefault(channel) { isDefault(channel) {
return channel.name === Constants.DEFAULT_CHANNEL; return channel.name === Constants.DEFAULT_CHANNEL;
} }
pSetPostMode(mode) { setPostMode(mode) {
this.postMode = mode; this.postMode = mode;
} }
@@ -292,21 +292,21 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
case ActionTypes.CLICK_CHANNEL: case ActionTypes.CLICK_CHANNEL:
ChannelStore.setCurrentId(action.id); ChannelStore.setCurrentId(action.id);
ChannelStore.resetCounts(action.id); ChannelStore.resetCounts(action.id);
ChannelStore.pSetPostMode(ChannelStore.POST_MODE_CHANNEL); ChannelStore.setPostMode(ChannelStore.POST_MODE_CHANNEL);
ChannelStore.emitChange(); ChannelStore.emitChange();
break; break;
case ActionTypes.RECIEVED_FOCUSED_POST: { case ActionTypes.RECIEVED_FOCUSED_POST: {
const post = action.post_list.posts[action.postId]; const post = action.post_list.posts[action.postId];
ChannelStore.setCurrentId(post.channel_id); ChannelStore.setCurrentId(post.channel_id);
ChannelStore.pSetPostMode(ChannelStore.POST_MODE_FOCUS); ChannelStore.setPostMode(ChannelStore.POST_MODE_FOCUS);
ChannelStore.emitChange(); ChannelStore.emitChange();
break; break;
} }
case ActionTypes.RECIEVED_CHANNELS: case ActionTypes.RECIEVED_CHANNELS:
ChannelStore.pStoreChannels(action.channels); ChannelStore.storeChannels(action.channels);
ChannelStore.pStoreChannelMembers(action.members); ChannelStore.storeChannelMembers(action.members);
currentId = ChannelStore.getCurrentId(); currentId = ChannelStore.getCurrentId();
if (currentId) { if (currentId) {
ChannelStore.resetCounts(currentId); ChannelStore.resetCounts(currentId);
@@ -329,14 +329,14 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
break; break;
case ActionTypes.RECIEVED_MORE_CHANNELS: case ActionTypes.RECIEVED_MORE_CHANNELS:
ChannelStore.pStoreMoreChannels(action.channels); ChannelStore.storeMoreChannels(action.channels);
ChannelStore.emitMoreChange(); ChannelStore.emitMoreChange();
break; break;
case ActionTypes.RECIEVED_CHANNEL_EXTRA_INFO: case ActionTypes.RECIEVED_CHANNEL_EXTRA_INFO:
var extraInfos = ChannelStore.pGetExtraInfos(); var extraInfos = ChannelStore.getExtraInfos();
extraInfos[action.extra_info.id] = action.extra_info; extraInfos[action.extra_info.id] = action.extra_info;
ChannelStore.pStoreExtraInfos(extraInfos); ChannelStore.storeExtraInfos(extraInfos);
ChannelStore.emitExtraInfoChange(); ChannelStore.emitExtraInfoChange();
break; break;