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
|
||||
}
|
||||
|
||||
if dialog.Dialog.Elements == nil || len(dialog.Dialog.Elements) == 0 {
|
||||
c.SetInvalidParam("dialog.elements")
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.App.OpenInteractiveDialog(dialog); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
@@ -142,16 +142,16 @@ func TestOpenDialog(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
assert.False(t, pass)
|
||||
|
||||
// At least one element is required
|
||||
// Should pass with no elements
|
||||
request.URL = "http://localhost:8065"
|
||||
request.Dialog.Elements = nil
|
||||
pass, resp = Client.OpenInteractiveDialog(request)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
assert.False(t, pass)
|
||||
CheckNoError(t, resp)
|
||||
assert.True(t, pass)
|
||||
request.Dialog.Elements = []model.DialogElement{}
|
||||
pass, resp = Client.OpenInteractiveDialog(request)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
assert.False(t, pass)
|
||||
CheckNoError(t, resp)
|
||||
assert.True(t, pass)
|
||||
}
|
||||
|
||||
func TestSubmitDialog(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user