Этот коммит содержится в:
Christopher Speller
2016-11-14 07:09:41 -05:00
родитель d1207d34c1 b55ec6148c
Коммит 323ce8b203
60 изменённых файлов: 1180 добавлений и 678 удалений

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

@@ -111,26 +111,31 @@ export function getChannel(id) {
}
export function getMyChannelMembers() {
if (isCallInProgress('getMyChannelMembers')) {
return;
}
callTracker.getMyChannelMembers = utils.getTimestamp();
Client.getMyChannelMembers(
(data) => {
callTracker.getMyChannelMembers = 0;
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
members: data
});
},
(err) => {
callTracker.getChannelsUnread = 0;
dispatchError(err, 'getMyChannelMembers');
return new Promise((resolve, reject) => {
if (isCallInProgress('getMyChannelMembers')) {
resolve();
return;
}
);
callTracker.getMyChannelMembers = utils.getTimestamp();
Client.getMyChannelMembers(
(data) => {
callTracker.getMyChannelMembers = 0;
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
members: data
});
resolve();
},
(err) => {
callTracker.getChannelsUnread = 0;
dispatchError(err, 'getMyChannelMembers');
reject();
}
);
});
}
export function updateLastViewedAt(id, active) {
@@ -263,28 +268,33 @@ export function getChannelStats(channelId = ChannelStore.getCurrentId(), doVersi
}
export function getChannelMember(channelId, userId) {
if (isCallInProgress(`getChannelMember${channelId}${userId}`)) {
return;
}
callTracker[`getChannelMember${channelId}${userId}`] = utils.getTimestamp();
Client.getChannelMember(
channelId,
userId,
(data) => {
callTracker[`getChannelMember${channelId}${userId}`] = 0;
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_CHANNEL_MEMBER,
member: data
});
},
(err) => {
callTracker[`getChannelMember${channelId}${userId}`] = 0;
dispatchError(err, 'getChannelMember');
return new Promise((resolve, reject) => {
if (isCallInProgress(`getChannelMember${channelId}${userId}`)) {
resolve();
return;
}
);
callTracker[`getChannelMember${channelId}${userId}`] = utils.getTimestamp();
Client.getChannelMember(
channelId,
userId,
(data) => {
callTracker[`getChannelMember${channelId}${userId}`] = 0;
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_CHANNEL_MEMBER,
member: data
});
resolve();
},
(err) => {
callTracker[`getChannelMember${channelId}${userId}`] = 0;
dispatchError(err, 'getChannelMember');
reject();
}
);
});
}
export function getUser(userId) {

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

@@ -70,6 +70,7 @@ export const ActionTypes = keyMirror({
RECEIVED_CHANNELS: null,
RECEIVED_CHANNEL: null,
RECEIVED_CHANNEL_MEMBER: null,
RECEIVED_MORE_CHANNELS: null,
RECEIVED_CHANNEL_STATS: null,
RECEIVED_MY_CHANNEL_MEMBERS: null,

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

@@ -1270,7 +1270,15 @@ export function isValidPassword(password) {
}
export function getSiteURL() {
return global.mm_config.SiteURL || window.location.origin;
if (global.mm_config.SiteURL) {
return global.mm_config.SiteURL;
}
if (window.location.origin) {
return window.location.origin;
}
return window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
}
export function handleFormattedTextClick(e) {