Merge pull request #383 from rgarmsen2295/mm-1584b
MM-1584 Private message channels no longer do a page refresh on creation/first use
Этот коммит содержится в:
@@ -438,6 +438,23 @@ module.exports.createChannel = function(channel, success, error) {
|
||||
module.exports.track('api', 'api_channels_create', channel.type, 'name', channel.name);
|
||||
};
|
||||
|
||||
module.exports.createDirectChannel = function(channel, userId, success, error) {
|
||||
$.ajax({
|
||||
url: '/api/v1/channels/create_direct',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({user_id: userId}),
|
||||
success: success,
|
||||
error: function(xhr, status, err) {
|
||||
var e = handleError('createDirectChannel', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports.track('api', 'api_channels_create_direct', channel.type, 'name', channel.name);
|
||||
};
|
||||
|
||||
module.exports.updateChannel = function(channel, success, error) {
|
||||
$.ajax({
|
||||
url: "/api/v1/channels/update",
|
||||
|
||||
@@ -968,4 +968,17 @@ module.exports.generateId = function() {
|
||||
|
||||
module.exports.isBrowserFirefox = function() {
|
||||
return navigator && navigator.userAgent && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
}
|
||||
};
|
||||
|
||||
// Used to get the id of the other user from a DM channel
|
||||
module.exports.getUserIdFromChannelName = function(channel) {
|
||||
var ids = channel.name.split('__');
|
||||
var otherUserId = '';
|
||||
if (ids[0] === UserStore.getCurrentId()) {
|
||||
otherUserId = ids[1];
|
||||
} else {
|
||||
otherUserId = ids[0];
|
||||
}
|
||||
|
||||
return otherUserId;
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user