From 67608a833b5d3e004e3a424b90d922d749840258 Mon Sep 17 00:00:00 2001 From: Ibrahim Serdar Acikgoz Date: Thu, 28 Jul 2022 07:33:55 +0300 Subject: [PATCH] Update product adapter for changes in the UserService (#3401) * reflect changes in server regarding to user service * include server into build even in CI * Fix lint pipeline to use only local repositories Signed-off-by: Mustafa Kara Co-authored-by: Mattermod Co-authored-by: Mustafa Kara --- .github/workflows/lint-server.yml | 1 + mattermost-plugin/build/gowork/main.go | 14 +++++++++++--- mattermost-plugin/product/api_adapter.go | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-server.yml b/.github/workflows/lint-server.yml index ab55a3308..ea141a603 100644 --- a/.github/workflows/lint-server.yml +++ b/.github/workflows/lint-server.yml @@ -9,6 +9,7 @@ on: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + USE_LOCAL_MATTERMOST-SERVER_REPO: true jobs: golangci: diff --git a/mattermost-plugin/build/gowork/main.go b/mattermost-plugin/build/gowork/main.go index 70414d273..cf66452c6 100644 --- a/mattermost-plugin/build/gowork/main.go +++ b/mattermost-plugin/build/gowork/main.go @@ -42,17 +42,25 @@ func main() { } func makeGoWork(ci bool) string { + repos := []string{ + "mattermost-server", + "enterprise", + } + var b strings.Builder b.WriteString("go 1.18\n\n") b.WriteString("use ./mattermost-plugin\n") b.WriteString("use ./server\n") + for repoIdx := range repos { + if isEnvVarTrue(fmt.Sprintf("USE_LOCAL_%s_REPO", strings.ToUpper(repos[repoIdx])), true) { + b.WriteString(fmt.Sprintf("use ../%s\n", repos[repoIdx])) + } + } + if ci { b.WriteString("use ./linux\n") - } else { - b.WriteString("use ../mattermost-server\n") - b.WriteString("use ../enterprise\n") } return b.String() diff --git a/mattermost-plugin/product/api_adapter.go b/mattermost-plugin/product/api_adapter.go index 75dcbd577..e129d6852 100644 --- a/mattermost-plugin/product/api_adapter.go +++ b/mattermost-plugin/product/api_adapter.go @@ -34,7 +34,7 @@ type serviceAPIAdapter struct { func newServiceAPIAdapter(api *boardsProduct) *serviceAPIAdapter { return &serviceAPIAdapter{ api: api, - ctx: &request.Context{}, + ctx: request.EmptyContext(api.logger), } } @@ -94,7 +94,7 @@ func (a *serviceAPIAdapter) GetUserByEmail(email string) (*mm_model.User, error) } func (a *serviceAPIAdapter) UpdateUser(user *mm_model.User) (*mm_model.User, error) { - user, appErr := a.api.userService.UpdateUser(user, true) + user, appErr := a.api.userService.UpdateUser(a.ctx, user, true) return user, normalizeAppErr(appErr) }