Этот коммит содержится в:
=Corey Hulen
2016-01-08 12:41:26 -06:00
родитель 001a4448ca
Коммит 3fba8e42b1
17 изменённых файлов: 578 добавлений и 78 удалений

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

@@ -134,15 +134,10 @@ export default class CreatePost extends React.Component {
post.message,
false,
(data) => {
if (data.response === 'not implemented') {
this.sendMessage(post);
return;
}
PostStore.storeDraft(data.channel_id, null);
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
if (data.goto_location.length > 0) {
if (data.goto_location && data.goto_location.length > 0) {
window.location.href = data.goto_location;
}
},

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

@@ -747,20 +747,28 @@ export function savePreferences(preferences, success, error) {
}
export function getSuggestedCommands(command, suggestionId, component) {
client.executeCommand(
'',
command,
true,
client.listCommands(
(data) => {
var matches = [];
data.forEach((cmd) => {
if (('/' + cmd.trigger).indexOf(command) === 0) {
matches.push({
suggestion: '/' + cmd.trigger + ' ' + cmd.auto_complete_hint,
description: cmd.auto_complete_desc
});
}
});
// pull out the suggested commands from the returned data
const terms = data.suggestions.map((suggestion) => suggestion.suggestion);
//const terms = matches.map((suggestion) => suggestion.trigger);
const terms = matches.map((suggestion) => suggestion.suggestion);
AppDispatcher.handleServerAction({
type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS,
id: suggestionId,
matchedPretext: command,
terms,
items: data.suggestions,
items: matches,
component
});
},

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

@@ -839,7 +839,7 @@ export function getChannelExtraInfo(id, success, error) {
export function executeCommand(channelId, command, suggest, success, error) {
$.ajax({
url: '/api/v1/command',
url: '/api/v1/commands/execute',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
@@ -852,6 +852,20 @@ export function executeCommand(channelId, command, suggest, success, error) {
});
}
export function listCommands(success, error) {
$.ajax({
url: '/api/v1/commands/list',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
success,
error: function onError(xhr, status, err) {
var e = handleError('listCommands', xhr, status, err);
error(e);
}
});
}
export function getPostsPage(channelId, offset, limit, success, error, complete) {
$.ajax({
cache: false,