[MM-15220] Add generic error field to SubmitDialogResponse (#12081)
This will allow integrations to return an generic error message that is not tied to a specific dialog field.
Этот коммит содержится в:
коммит произвёл
Ben Schumacher
родитель
98489b9e67
Коммит
9c3fc4ab9f
@@ -430,6 +430,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
|
|||||||
assert.Equal(t, "value1", val)
|
assert.Equal(t, "value1", val)
|
||||||
|
|
||||||
resp := model.SubmitDialogResponse{
|
resp := model.SubmitDialogResponse{
|
||||||
|
Error: "some generic error",
|
||||||
Errors: map[string]string{"name1": "some error"},
|
Errors: map[string]string{"name1": "some error"},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,6 +445,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
|
|||||||
resp, err := th.App.SubmitInteractiveDialog(submit)
|
resp, err := th.App.SubmitInteractiveDialog(submit)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
require.NotNil(t, resp)
|
require.NotNil(t, resp)
|
||||||
|
assert.Equal(t, "some generic error", resp.Error)
|
||||||
assert.Equal(t, "some error", resp.Errors["name1"])
|
assert.Equal(t, "some error", resp.Errors["name1"])
|
||||||
|
|
||||||
submit.URL = ""
|
submit.URL = ""
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ type SubmitDialogRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SubmitDialogResponse struct {
|
type SubmitDialogResponse struct {
|
||||||
|
Error string `json:"error,omitempty"`
|
||||||
Errors map[string]string `json:"errors,omitempty"`
|
Errors map[string]string `json:"errors,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ func TestSubmitDialogRequestToJson(t *testing.T) {
|
|||||||
func TestSubmitDialogResponseToJson(t *testing.T) {
|
func TestSubmitDialogResponseToJson(t *testing.T) {
|
||||||
t.Run("all fine", func(t *testing.T) {
|
t.Run("all fine", func(t *testing.T) {
|
||||||
request := SubmitDialogResponse{
|
request := SubmitDialogResponse{
|
||||||
|
Error: "some generic error",
|
||||||
Errors: map[string]string{
|
Errors: map[string]string{
|
||||||
"text": "some text",
|
"text": "some text",
|
||||||
"float": "1.2",
|
"float": "1.2",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user