MM-15128 change openDialog to allow dialogs with no elements (#10755)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
d4225349ef
Коммит
290d000ad2
@@ -79,11 +79,6 @@ func openDialog(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if dialog.Dialog.Elements == nil || len(dialog.Dialog.Elements) == 0 {
|
|
||||||
c.SetInvalidParam("dialog.elements")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := c.App.OpenInteractiveDialog(dialog); err != nil {
|
if err := c.App.OpenInteractiveDialog(dialog); err != nil {
|
||||||
c.Err = err
|
c.Err = err
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -142,16 +142,16 @@ func TestOpenDialog(t *testing.T) {
|
|||||||
CheckBadRequestStatus(t, resp)
|
CheckBadRequestStatus(t, resp)
|
||||||
assert.False(t, pass)
|
assert.False(t, pass)
|
||||||
|
|
||||||
// At least one element is required
|
// Should pass with no elements
|
||||||
request.URL = "http://localhost:8065"
|
request.URL = "http://localhost:8065"
|
||||||
request.Dialog.Elements = nil
|
request.Dialog.Elements = nil
|
||||||
pass, resp = Client.OpenInteractiveDialog(request)
|
pass, resp = Client.OpenInteractiveDialog(request)
|
||||||
CheckBadRequestStatus(t, resp)
|
CheckNoError(t, resp)
|
||||||
assert.False(t, pass)
|
assert.True(t, pass)
|
||||||
request.Dialog.Elements = []model.DialogElement{}
|
request.Dialog.Elements = []model.DialogElement{}
|
||||||
pass, resp = Client.OpenInteractiveDialog(request)
|
pass, resp = Client.OpenInteractiveDialog(request)
|
||||||
CheckBadRequestStatus(t, resp)
|
CheckNoError(t, resp)
|
||||||
assert.False(t, pass)
|
assert.True(t, pass)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSubmitDialog(t *testing.T) {
|
func TestSubmitDialog(t *testing.T) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user