Skip to content

Commit

Permalink
Remove unnecessary uses of getMoreChannels (mattermost#5982)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander authored and enahum committed Apr 5, 2017
1 parent 812f1d5 commit 36f7d48
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 41 deletions.
1 change: 0 additions & 1 deletion actions/global_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export function doFocusPost(channelId, postId, data) {
post_list: data
});
loadChannelsForCurrentUser();
AsyncClient.getMoreChannels(true);
AsyncClient.getChannelStats(channelId);
loadPostsBefore(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
loadPostsAfter(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
Expand Down
12 changes: 0 additions & 12 deletions client/client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1562,18 +1562,6 @@ export default class Client {
this.trackEvent('api', 'api_channel_get', {team_id: this.getTeamId(), channel_id: channelId});
}

// SCHEDULED FOR DEPRECATION IN 3.7 - use getMoreChannelsPage instead
getMoreChannels(success, error) {
request.
get(`${this.getChannelsRoute()}/more`).
set(this.defaultHeaders).
type('application/json').
accept('application/json').
end(this.handleResponse.bind(this, 'getMoreChannels', success, error));

this.trackEvent('api', 'api_channels_more', {team_id: this.getTeamId()});
}

getMoreChannelsPage(offset, limit, success, error) {
request.
get(`${this.getChannelsRoute()}/more/${offset}/${limit}`).
Expand Down
5 changes: 1 addition & 4 deletions components/channel_select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Constants from 'utils/constants.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {sortChannelsByDisplayName} from 'utils/channel_utils.jsx';
import * as AsyncClient from 'utils/async_client.jsx';

export default class ChannelSelect extends React.Component {
static get propTypes() {
Expand All @@ -34,8 +33,6 @@ export default class ChannelSelect extends React.Component {
this.handleChannelChange = this.handleChannelChange.bind(this);
this.filterChannels = this.filterChannels.bind(this);

AsyncClient.getMoreChannels(true);

this.state = {
channels: ChannelStore.getAll().filter(this.filterChannels).sort(sortChannelsByDisplayName)
};
Expand All @@ -51,7 +48,7 @@ export default class ChannelSelect extends React.Component {

handleChannelChange() {
this.setState({
channels: ChannelStore.getAll().concat(ChannelStore.getMoreAll()).
channels: ChannelStore.getAll().
filter(this.filterChannels).sort(sortChannelsByDisplayName)
});
}
Expand Down
24 changes: 0 additions & 24 deletions utils/async_client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,30 +208,6 @@ export function viewChannel(channelId = ChannelStore.getCurrentId(), prevChannel
);
}

export function getMoreChannels(force) {
if (isCallInProgress('getMoreChannels')) {
return;
}

if (ChannelStore.getMoreAll().loading || force) {
callTracker.getMoreChannels = utils.getTimestamp();
Client.getMoreChannels(
(data) => {
callTracker.getMoreChannels = 0;

AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_MORE_CHANNELS,
channels: data
});
},
(err) => {
callTracker.getMoreChannels = 0;
dispatchError(err, 'getMoreChannels');
}
);
}
}

export function getMoreChannelsPage(offset, limit) {
if (isCallInProgress('getMoreChannelsPage')) {
return;
Expand Down

0 comments on commit 36f7d48

Please sign in to comment.