summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx61
1 files changed, 0 insertions, 61 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 10a59c25c..fcfec3592 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -10,7 +10,6 @@ import PreferenceStore from 'stores/preference_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
var ActionTypes = Constants.ActionTypes;
-import * as AsyncClient from './async_client.jsx';
import Client from 'client/web_client.jsx';
import * as UserAgent from 'utils/user_agent.jsx';
@@ -1074,66 +1073,6 @@ export function windowHeight() {
return $(window).height();
}
-export function openDirectChannelToUser(user, successCb, errorCb) {
- AsyncClient.savePreference(
- Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
- user.id,
- 'true'
- );
-
- // if the user in another team and isn't already in the direct message
- // list then we should add him so his name shows up correctly.
- var profileUser = UserStore.getProfile(user.id);
- if (!profileUser) {
- UserStore.getDirectProfiles()[user.id] = user;
- }
-
- const channelName = this.getDirectChannelName(UserStore.getCurrentId(), user.id);
- let channel = ChannelStore.getByName(channelName);
-
- if (channel) {
- if ($.isFunction(successCb)) {
- successCb(channel, true);
- }
- } else {
- channel = {
- name: channelName,
- last_post_at: 0,
- total_msg_count: 0,
- type: 'D',
- display_name: user.username,
- teammate_id: user.id,
- status: UserStore.getStatus(user.id)
- };
-
- Client.createDirectChannel(
- user.id,
- (data) => {
- Client.getChannel(
- data.id,
- (data2) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_CHANNEL,
- channel: data2.channel,
- member: data2.member
- });
-
- if ($.isFunction(successCb)) {
- successCb(data2.channel, false);
- }
- }
- );
- },
- () => {
- browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channelName);
- if ($.isFunction(errorCb)) {
- errorCb();
- }
- }
- );
- }
-}
-
// Use when sorting multiple channels or teams by their `display_name` field
export function sortByDisplayName(a, b) {
let aDisplayName = '';