mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
add external slashcommands management
This commit is contained in:
@@ -755,12 +755,15 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user