Merge pull request #2169 from kernicPanel/external-slashcommands-management

PLT-2183 Slash command auto-complete
Этот коммит содержится в:
Christopher Speller
2016-03-17 11:45:42 -04:00
родитель d42459729c c94b7b9d4f
Коммит 6b9d895224
14 изменённых файлов: 333 добавлений и 151 удалений

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

@@ -755,12 +755,12 @@ export function savePreferences(preferences, success, error) {
);
}
export function getSuggestedCommands(command, suggestionId, component) {
client.listCommands(
export function getSuggestedCommands(command, channelId, suggestionId, component) {
client.listCommands({command: command, channelId: channelId},
(data) => {
var matches = [];
data.forEach((cmd) => {
if (('/' + cmd.trigger).indexOf(command) === 0) {
if (('/' + cmd.trigger).indexOf(command) === 0 || cmd.external_management) {
let s = '/' + cmd.trigger;
let hint = '';
if (cmd.auto_complete_hint && cmd.auto_complete_hint.length !== 0) {

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

@@ -1002,12 +1002,13 @@ export function regenCommandToken(data, success, error) {
});
}
export function listCommands(success, error) {
export function listCommands(data, success, error) {
$.ajax({
url: '/api/v1/commands/list',
dataType: 'json',
contentType: 'application/json',
type: 'GET',
type: 'POST',
data: JSON.stringify(data),
success,
error: function onError(xhr, status, err) {
var e = handleError('listCommands', xhr, status, err);

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

@@ -560,6 +560,10 @@ export default {
EMBED_TOGGLE: {
label: 'embed_toggle',
description: 'Show toggle for all embed previews'
},
SLASHCMD_AUTOCMP: {
label: 'slashCmd_autocmp',
description: 'Enable external application to offer slash command autocomplete'
}
},
OVERLAY_TIME_DELAY: 400,