Skip to content

Commit

Permalink
Fix task slash commands being run. (#1889)
Browse files Browse the repository at this point in the history
* Fix task slash commands being run.

* Style fix.
  • Loading branch information
crspeller authored Mar 13, 2024
1 parent 363c6dc commit 0ed94b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions server/api/playbook_runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"sort"
Expand Down Expand Up @@ -1311,6 +1312,12 @@ func (h *PlaybookRunHandler) itemRun(c *Context, w http.ResponseWriter, r *http.
}
userID := r.Header.Get("Mattermost-User-ID")

// Check the body is empty
if _, err := r.Body.Read(make([]byte, 1)); err != io.EOF {
h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "request body must be empty", nil)
return
}

triggerID, err := h.playbookRunService.RunChecklistItemSlashCommand(playbookRunID, userID, checklistNum, itemNum)
if err != nil {
h.HandleError(w, c.logger, err)
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ export const doGet = async <TData = any>(url: string) => {
return data;
};

export const doPost = async <TData = any>(url: string, body = {}) => {
export const doPost = async <TData = any>(url: string, body: any = undefined) => {
const {data} = await doFetchWithResponse<TData>(url, {
method: 'POST',
body,
Expand All @@ -708,7 +708,7 @@ export const doPost = async <TData = any>(url: string, body = {}) => {
return data;
};

export const doPut = async <TData = any>(url: string, body = {}) => {
export const doPut = async <TData = any>(url: string, body: any = undefined) => {
const {data} = await doFetchWithResponse<TData>(url, {
method: 'PUT',
body,
Expand Down

0 comments on commit 0ed94b0

Please sign in to comment.