MM 50960 - Add company name and invite members pages to preparing-workspace for self-hosted (#22838)

* MM-50960 - store system organization name

* restore the preparing workspace plugins and invite screens

* add back the page lines for the design

* add lines back and organize styles

* set back documentation to monorepo style and disable board as a product

* fix organization link and style skip button

* create team on organization name screen continue button click

* make sure there are not already created team and if so just update team name

* update the team display name if team has already been created

* cover error scenarios during team creation

* add pr feedback and add a couple of unit tests

* fix translation server error; make sure only update display name if it has changed in the form

* temp advances

* rewrite unit tests using react-testing library; fix unit tests

* fix translations

* make sure the launching workspace finish in cloud installations

* remove redundant validation

* fix unit tests

* remove unintended config value left after merge conflict
Этот коммит содержится в:
Pablo Andrés Vélez Vidal
2023-04-19 15:31:47 +02:00
коммит произвёл GitHub
родитель a24111f9bd
Коммит b5c48e75b3
47 изменённых файлов: 2248 добавлений и 107 удалений

Просмотреть файл

@@ -892,6 +892,7 @@ func TestCompleteOnboarding(t *testing.T) {
req := &model.CompleteOnboardingRequest{
InstallPlugins: []string{"testplugin2"},
Organization: "my-org",
}
t.Run("as a regular user", func(t *testing.T) {

Просмотреть файл

@@ -28,6 +28,24 @@ func (a *App) markAdminOnboardingComplete(c *request.Context) *model.AppError {
}
func (a *App) CompleteOnboarding(c *request.Context, request *model.CompleteOnboardingRequest) *model.AppError {
isCloud := a.Srv().License() != nil && *a.Srv().License().Features.Cloud
if !isCloud && request.Organization == "" {
mlog.Error("No organization name provided for self hosted onboarding")
return model.NewAppError("CompleteOnboarding", "api.error_no_organization_name_provided_for_self_hosted_onboarding", nil, "", http.StatusBadRequest)
}
if request.Organization != "" {
err := a.Srv().Store().System().SaveOrUpdate(&model.System{
Name: model.SystemOrganizationName,
Value: request.Organization,
})
if err != nil {
// don't block onboarding because of that.
a.Log().Error("failed to save organization name", mlog.Err(err))
}
}
pluginsEnvironment := a.Channels().GetPluginsEnvironment()
if pluginsEnvironment == nil {
return a.markAdminOnboardingComplete(c)

30
server/channels/app/onboarding_test.go Обычный файл
Просмотреть файл

@@ -0,0 +1,30 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package app
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/server/v8/channels/app/request"
mm_model "github.com/mattermost/mattermost-server/server/v8/model"
)
func TestOnboardingSavesOrganizationName(t *testing.T) {
th := Setup(t)
defer th.TearDown()
err := th.App.CompleteOnboarding(&request.Context{}, &mm_model.CompleteOnboardingRequest{
Organization: "Mattermost In Tests",
})
require.Nil(t, err)
defer func() {
th.App.Srv().Store().System().PermanentDeleteByName(mm_model.SystemOrganizationName)
}()
sys, storeErr := th.App.Srv().Store().System().GetByName(mm_model.SystemOrganizationName)
require.NoError(t, storeErr)
require.Equal(t, "Mattermost In Tests", sys.Value)
}

Просмотреть файл

@@ -1777,6 +1777,10 @@
"id": "api.error_get_first_admin_visit_marketplace_status",
"translation": "Error trying to retrieve the first admin visit marketplace status from the store."
},
{
"id": "api.error_no_organization_name_provided_for_self_hosted_onboarding",
"translation": "Error no organization name provided for self hosted onboarding."
},
{
"id": "api.error_set_first_admin_complete_setup",
"translation": "Error trying to save first admin complete setup in the store."

Просмотреть файл

@@ -10,6 +10,7 @@ import (
// CompleteOnboardingRequest describes parameters of the requested plugin.
type CompleteOnboardingRequest struct {
Organization string `json:"organization"` // Organization is the name of the organization
InstallPlugins []string `json:"install_plugins"` // InstallPlugins is a list of plugins to be installed
}

Просмотреть файл

@@ -16,6 +16,7 @@ const (
SystemAsymmetricSigningKeyKey = "AsymmetricSigningKey"
SystemPostActionCookieSecretKey = "PostActionCookieSecret"
SystemInstallationDateKey = "InstallationDate"
SystemOrganizationName = "OrganizationName"
SystemFirstServerRunTimestampKey = "FirstServerRunTimestamp"
SystemClusterEncryptionKey = "ClusterEncryptionKey"
SystemUpgradedFromTeId = "UpgradedFromTE"