From 902f7296d211c9b2e72ea6d36dc721b5bc044d7d Mon Sep 17 00:00:00 2001 From: Giorgi Bochorishvili Date: Tue, 22 Nov 2022 07:47:07 +0400 Subject: [PATCH] Add playbooks product support. Add new methods to post service --- Makefile | 10 ++++++++++ app/post.go | 8 ++++++++ product/api.go | 2 ++ scripts/setup_go_work.sh | 1 + 4 files changed, 21 insertions(+) diff --git a/Makefile b/Makefile index d792c30126e..b0a0085eed2 100644 --- a/Makefile +++ b/Makefile @@ -195,6 +195,16 @@ else IGNORE:=$(shell rm -f imports/boards_imports.go) endif +# Playbooks +BUILD_PLAYBOOKS_DIR ?= ../mattermost-plugin-playbooks +BUILD_PLAYBOOKS ?= false + +ifeq ($(BUILD_PLAYBOOKS),true) +IGNORE:=$(shell cp $(BUILD_PLAYBOOKS_DIR)/product/imports/playbooks_imports.go imports/) +else + IGNORE:=$(shell rm -f imports/playbooks_imports.go) +endif + all: run ## Alias for 'run'. -include config.override.mk diff --git a/app/post.go b/app/post.go index ff6cab33974..40c0b1836d3 100644 --- a/app/post.go +++ b/app/post.go @@ -46,6 +46,14 @@ func (s *postServiceWrapper) CreatePost(ctx *request.Context, post *model.Post) return s.app.CreatePostMissingChannel(ctx, post, true) } +func (s *postServiceWrapper) GetPostsByIds(postIDs []string) ([]*model.Post, int64, *model.AppError) { + return s.app.GetPostsByIds(postIDs) +} + +func (s *postServiceWrapper) SendEphemeralPost(ctx *request.Context, userID string, post *model.Post) *model.Post { + return s.app.SendEphemeralPost(ctx, userID, post) +} + func (a *App) CreatePostAsUser(c request.CTX, post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError) { // Check that channel has not been deleted channel, errCh := a.Srv().Store().Channel().Get(post.ChannelId, true) diff --git a/product/api.go b/product/api.go index 88eb9744e43..f8e2a3999d4 100644 --- a/product/api.go +++ b/product/api.go @@ -31,6 +31,8 @@ type RouterService interface { // The service shall be registered via app.PostKey service key. type PostService interface { CreatePost(context *request.Context, post *model.Post) (*model.Post, *model.AppError) + GetPostsByIds(postIDs []string) ([]*model.Post, int64, *model.AppError) + SendEphemeralPost(ctx *request.Context, userID string, post *model.Post) *model.Post } // PermissionService provides permissions related utilities. For now, the service implementation diff --git a/scripts/setup_go_work.sh b/scripts/setup_go_work.sh index 76c70187369..1a683fee91b 100755 --- a/scripts/setup_go_work.sh +++ b/scripts/setup_go_work.sh @@ -16,5 +16,6 @@ then txt="${txt}use ../focalboard/server\nuse ../focalboard/mattermost-plugin\n" fi + txt="${txt}use ../mattermost-plugin-playbooks\n" printf "$txt" > "go.work" fi \ No newline at end of file