MM-12843 Add interactive dialogs (#9816)
* Add interactive dialogs * Fix unit test * Updates per feedback * Fix typo * Updates per feedback, add icon_url and error returns * Updates per feedback * Update per feedback
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7a6f957638
Коммит
8cfca681b0
@@ -4,7 +4,7 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/go-plugin"
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
@@ -339,6 +339,13 @@ type API interface {
|
||||
// Minimum server version: 5.6
|
||||
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
|
||||
|
||||
// OpenInteractiveDialog will open an interactive dialog on a user's client that
|
||||
// generated the trigger ID. Used with interactive message buttons, menus
|
||||
// and slash commands.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
|
||||
|
||||
// Plugin Section
|
||||
|
||||
// GetPlugins will return a list of plugin manifests for currently active plugins.
|
||||
|
||||
@@ -2870,6 +2870,34 @@ func (s *apiRPCServer) UploadFile(args *Z_UploadFileArgs, returns *Z_UploadFileR
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_OpenInteractiveDialogArgs struct {
|
||||
A model.OpenDialogRequest
|
||||
}
|
||||
|
||||
type Z_OpenInteractiveDialogReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError {
|
||||
_args := &Z_OpenInteractiveDialogArgs{dialog}
|
||||
_returns := &Z_OpenInteractiveDialogReturns{}
|
||||
if err := g.client.Call("Plugin.OpenInteractiveDialog", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to OpenInteractiveDialog API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) OpenInteractiveDialog(args *Z_OpenInteractiveDialogArgs, returns *Z_OpenInteractiveDialogReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.OpenInteractiveDialog(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API OpenInteractiveDialog called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetPluginsArgs struct {
|
||||
}
|
||||
|
||||
|
||||
@@ -1741,6 +1741,22 @@ func (_m *API) LogWarn(msg string, keyValuePairs ...interface{}) {
|
||||
_m.Called(_ca...)
|
||||
}
|
||||
|
||||
// OpenInteractiveDialog provides a mock function with given fields: dialog
|
||||
func (_m *API) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError {
|
||||
ret := _m.Called(dialog)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(model.OpenDialogRequest) *model.AppError); ok {
|
||||
r0 = rf(dialog)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// PublishWebSocketEvent provides a mock function with given fields: event, payload, broadcast
|
||||
func (_m *API) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) {
|
||||
_m.Called(event, payload, broadcast)
|
||||
|
||||
Ссылка в новой задаче
Block a user