partial fix for UI
Этот коммит содержится в:
@@ -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,
|
||||
|
||||
Ссылка в новой задаче
Block a user