[CLD-7567] Deprecate Self Serve: Second Pass (#26853)

* Deprecate Self Serve: First Pass

* Fix ci

* Fix more ci

* Remmove outdated server tests

* Fix a missed spot opening purchase modal in Self Hosted

* Fix i18n

* Clean up some more server code, fix webapp test

* Fix alignment of button

* Fix linter

* Fix i18n server side

* Deprecate in product true up

* Add back translation

* Remove client functions

* Put back client functions

* webapp deprecation

* Deprecate Self Serve: Second Pass

* Fix various pipeline issues

* Fix linter

* Fix pipelines

* Fix handlers_test.go

* Fix console.error around hostedCustomer in reducer

* PICKY LINTER PLEASE

* Fix webapp tests, various other fixes for the CI pipelines

* Fix i18n

* Updates to accomadate enterprise code removal

* Fix mocks

* More removal

* Fix

* Adjustments from PR

* Fixes for QA Feedback

* Update

* Add migrations to remove true up review history

* Fix migrations check

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
Этот коммит содержится в:
Nick Misasi
2024-05-02 09:15:15 -04:00
коммит произвёл GitHub
родитель 6028cbe4e2
Коммит f1019d076e
127 изменённых файлов: 169 добавлений и 8222 удалений

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

@@ -340,10 +340,6 @@ func (c *Client4) cloudRoute() string {
return "/cloud"
}
func (c *Client4) hostedCustomerRoute() string {
return "/hosted_customer"
}
func (c *Client4) testEmailRoute() string {
return "/email/test"
}
@@ -584,10 +580,6 @@ func (c *Client4) permissionsRoute() string {
return "/permissions"
}
func (c *Client4) limitsRoute() string {
return "/limits"
}
func (c *Client4) bookmarksRoute(channelId string) string {
return c.channelRoute(channelId) + "/bookmarks"
}
@@ -8305,50 +8297,6 @@ func (c *Client4) GetMyIP(ctx context.Context) (*GetIPAddressResponse, *Response
return response, BuildResponse(r), nil
}
func (c *Client4) CreateCustomerPayment(ctx context.Context) (*StripeSetupIntent, *Response, error) {
r, err := c.DoAPIPost(ctx, c.cloudRoute()+"/payment", "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var setupIntent *StripeSetupIntent
json.NewDecoder(r.Body).Decode(&setupIntent)
return setupIntent, BuildResponse(r), nil
}
func (c *Client4) ConfirmCustomerPayment(ctx context.Context, confirmRequest *ConfirmPaymentMethodRequest) (*Response, error) {
json, err := json.Marshal(confirmRequest)
if err != nil {
return nil, NewAppError("ConfirmCustomerPayment", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPostBytes(ctx, c.cloudRoute()+"/payment/confirm", json)
if err != nil {
return BuildResponse(r), err
}
defer closeBody(r)
return BuildResponse(r), nil
}
func (c *Client4) RequestCloudTrial(ctx context.Context, cloudTrialRequest *StartCloudTrialRequest) (*Subscription, *Response, error) {
payload, err := json.Marshal(cloudTrialRequest)
if err != nil {
return nil, nil, NewAppError("RequestCloudTrial", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPutBytes(ctx, c.cloudRoute()+"/request-trial", payload)
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var subscription *Subscription
json.NewDecoder(r.Body).Decode(&subscription)
return subscription, BuildResponse(r), nil
}
func (c *Client4) ValidateWorkspaceBusinessEmail(ctx context.Context) (*Response, error) {
r, err := c.DoAPIPost(ctx, c.cloudRoute()+"/validate-workspace-business-email", "")
if err != nil {
@@ -8415,19 +8363,6 @@ func (c *Client4) GetCloudCustomer(ctx context.Context) (*CloudCustomer, *Respon
return cloudCustomer, BuildResponse(r), nil
}
func (c *Client4) GetSubscriptionStatus(ctx context.Context, licenseId string) (*SubscriptionLicenseSelfServeStatusResponse, *Response, error) {
r, err := c.DoAPIGet(ctx, fmt.Sprintf("%s%s?licenseID=%s", c.cloudRoute(), "/subscription/self-serve-status", licenseId), "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var status *SubscriptionLicenseSelfServeStatusResponse
json.NewDecoder(r.Body).Decode(&status)
return status, BuildResponse(r), nil
}
func (c *Client4) GetSubscription(ctx context.Context) (*Subscription, *Response, error) {
r, err := c.DoAPIGet(ctx, c.cloudRoute()+"/subscription", "")
if err != nil {
@@ -8488,23 +8423,6 @@ func (c *Client4) UpdateCloudCustomerAddress(ctx context.Context, address *Addre
return customer, BuildResponse(r), nil
}
func (c *Client4) BootstrapSelfHostedSignup(ctx context.Context, req BootstrapSelfHostedSignupRequest) (*BootstrapSelfHostedSignupResponse, *Response, error) {
reqBytes, err := json.Marshal(req)
if err != nil {
return nil, nil, NewAppError("BootstrapSelfHostedSignup", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPostBytes(ctx, c.hostedCustomerRoute()+"/bootstrap", reqBytes)
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var res *BootstrapSelfHostedSignupResponse
json.NewDecoder(r.Body).Decode(&res)
return res, BuildResponse(r), nil
}
func (c *Client4) ListImports(ctx context.Context) ([]string, *Response, error) {
r, err := c.DoAPIGet(ctx, c.importsRoute(), "")
if err != nil {
@@ -8793,96 +8711,6 @@ func (c *Client4) GetTeamsUsage(ctx context.Context) (*TeamsUsage, *Response, er
return usage, BuildResponse(r), err
}
func (c *Client4) SelfHostedSignupAvailable(ctx context.Context) (*Response, error) {
r, err := c.DoAPIGet(ctx, c.hostedCustomerRoute()+"/signup_available", "")
if err != nil {
return BuildResponse(r), err
}
defer closeBody(r)
return BuildResponse(r), nil
}
func (c *Client4) SelfHostedSignupCustomer(ctx context.Context, form *SelfHostedCustomerForm) (*Response, *SelfHostedSignupCustomerResponse, error) {
payloadBytes, err := json.Marshal(form)
if err != nil {
return nil, nil, NewAppError("SelfHostedSignupCustomer", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPost(ctx, c.hostedCustomerRoute()+"/customer", string(payloadBytes))
if err != nil {
return BuildResponse(r), nil, err
}
data, err := io.ReadAll(r.Body)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
response := SelfHostedSignupCustomerResponse{}
err = json.Unmarshal(data, &response)
if err != nil {
return BuildResponse(r), nil, err
}
return BuildResponse(r), &response, nil
}
func (c *Client4) SelfHostedSignupConfirm(ctx context.Context, form *SelfHostedConfirmPaymentMethodRequest) (*Response, *SelfHostedSignupConfirmClientResponse, error) {
payloadBytes, err := json.Marshal(form)
if err != nil {
return nil, nil, NewAppError("SelfHostedSignupConfirm", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPost(ctx, c.hostedCustomerRoute()+"/confirm", string(payloadBytes))
if err != nil {
return BuildResponse(r), nil, err
}
data, err := io.ReadAll(r.Body)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
response := SelfHostedSignupConfirmClientResponse{}
err = json.Unmarshal(data, &response)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
return BuildResponse(r), &response, nil
}
func (c *Client4) GetSelfHostedInvoices(ctx context.Context) (*Response, []*Invoice, error) {
r, err := c.DoAPIGet(ctx, c.hostedCustomerRoute()+"/invoices", "")
if err != nil {
return BuildResponse(r), nil, err
}
data, err := io.ReadAll(r.Body)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
invoices := []*Invoice{}
err = json.Unmarshal(data, &invoices)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
return BuildResponse(r), invoices, nil
}
func (c *Client4) GetPostInfo(ctx context.Context, postId string) (*PostInfo, *Response, error) {
r, err := c.DoAPIGet(ctx, c.postRoute(postId)+"/info", "")
if err != nil {
@@ -8939,36 +8767,6 @@ func (c *Client4) CheckCWSConnection(ctx context.Context, userId string) (*Respo
return BuildResponse(r), nil
}
func (c *Client4) SubmitTrueUpReview(ctx context.Context, req map[string]any) (*Response, error) {
reqBytes, err := json.Marshal(req)
if err != nil {
return nil, NewAppError("SubmitTrueUpReview", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPostBytes(ctx, c.licenseRoute()+"/review", reqBytes)
if err != nil {
return BuildResponse(r), nil
}
defer closeBody(r)
return BuildResponse(r), nil
}
func (c *Client4) GetServerLimits(ctx context.Context) (*ServerLimits, *Response, error) {
r, err := c.DoAPIGet(ctx, c.limitsRoute()+"/users", "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var serverLimits ServerLimits
if r.StatusCode == http.StatusNotModified {
return &serverLimits, BuildResponse(r), nil
}
if err := json.NewDecoder(r.Body).Decode(&serverLimits); err != nil {
return nil, nil, NewAppError("GetServerLimits", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
return &serverLimits, BuildResponse(r), nil
}
// CreateChannelBookmark creates a channel bookmark based on the provided struct.
func (c *Client4) CreateChannelBookmark(ctx context.Context, channelBookmark *ChannelBookmark) (*ChannelBookmark, *Response, error) {
channelBookmarkJSON, err := json.Marshal(channelBookmark)

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

@@ -403,7 +403,6 @@ type ServiceSettings struct {
CollapsedThreads *string `access:"experimental_features"`
ManagedResourcePaths *string `access:"environment_web_server,write_restrictable,cloud_restrictable"`
EnableCustomGroups *bool `access:"site_users_and_teams"`
SelfHostedPurchase *bool `access:"write_restrictable,cloud_restrictable"`
AllowSyncedDrafts *bool `access:"site_posts"`
UniqueEmojiReactionLimitPerPost *int `access:"site_posts"`
RefreshPostStatsRunTime *string `access:"site_users_and_teams"`
@@ -903,10 +902,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
s.AllowSyncedDrafts = NewBool(true)
}
if s.SelfHostedPurchase == nil {
s.SelfHostedPurchase = NewBool(true)
}
if s.UniqueEmojiReactionLimitPerPost == nil {
s.UniqueEmojiReactionLimitPerPost = NewInt(ServiceSettingsDefaultUniqueReactionsPerPost)
}

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

@@ -3,71 +3,8 @@
package model
type BootstrapSelfHostedSignupRequest struct {
Email string `json:"email"`
Reset bool `json:"reset"`
}
type SubscribeNewsletterRequest struct {
Email string `json:"email"`
ServerID string `json:"server_id"`
SubscribedContent string `json:"subscribed_content"`
}
type BootstrapSelfHostedSignupResponse struct {
Progress string `json:"progress"`
// email listed on the JWT claim
Email string `json:"email"`
}
type BootstrapSelfHostedSignupResponseInternal struct {
Progress string `json:"progress"`
License string `json:"license"`
}
// email contained in token, so not in the request body.
type SelfHostedCustomerForm struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
BillingAddress *Address `json:"billing_address"`
ShippingAddress *Address `json:"shipping_address"`
Organization string `json:"organization"`
}
type SelfHostedConfirmPaymentMethodRequest struct {
StripeSetupIntentID string `json:"stripe_setup_intent_id"`
Subscription *CreateSubscriptionRequest `json:"subscription"`
ExpandRequest *SelfHostedExpansionRequest `json:"expand_request"`
}
// SelfHostedSignupPaymentResponse contains feels needed for self hosted signup to confirm payment and receive license.
type SelfHostedSignupCustomerResponse struct {
CustomerId string `json:"customer_id"`
SetupIntentId string `json:"setup_intent_id"`
SetupIntentSecret string `json:"setup_intent_secret"`
Progress string `json:"progress"`
}
// SelfHostedSignupConfirmResponse contains data received on successful self hosted signup
type SelfHostedSignupConfirmResponse struct {
License string `json:"license"`
Progress string `json:"progress"`
}
type SelfHostedSignupConfirmClientResponse struct {
License map[string]string `json:"license"`
Progress string `json:"progress"`
}
type SelfHostedBillingAccessRequest struct {
LicenseId string `json:"license_id"`
}
type SelfHostedBillingAccessResponse struct {
Token string `json:"token"`
}
type SelfHostedExpansionRequest struct {
Seats int `json:"seats"`
LicenseId string `json:"license_id"`
}

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

@@ -39,15 +39,6 @@ var (
sanctionedTrialDurationUpperBound = 29*(time.Hour*24) + (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) // 696 hours (29 days) + 23 hours, 59 mins and 59 seconds
)
const (
TrueUpReviewTelemetryName = "true_up_review_sent"
TrueUpReviewAuthFeaturesMfa = "multi_factor_authentication"
TrueUpReviewAuthFeaturesADLdap = "ad_ldap_sign_in"
TrueUpReviewAuthFeaturesSaml = "saml_sign_in"
TrueUpReviewAuthFeatureOpenId = "openid_connect"
TrueUpReviewAuthFeatureGuestAccess = "guest_access"
)
type LicenseRecord struct {
Id string `json:"id"`
CreateAt int64 `json:"create_at"`

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

@@ -1,47 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import "strings"
type TrueUpReviewProfile struct {
ServerId string `json:"server_id"`
ServerVersion string `json:"server_version"`
ServerInstallationType string `json:"server_installation_type"`
LicenseId string `json:"license_id"`
LicensedSeats int `json:"licensed_seats"`
LicensePlan string `json:"license_plan"`
CustomerName string `json:"customer_name"`
ActivatedUsers int64 `json:"total_activated_users"`
DailyActiveUsers int64 `json:"daily_active_users"`
MonthlyActiveUsers int64 `json:"monthly_active_users"`
AuthenticationFeatures []string `json:"authentication_features"`
Plugins TrueUpReviewPlugins `json:"plugins"`
TotalIncomingWebhooks int64 `json:"incoming_webhooks_count"`
TotalOutgoingWebhooks int64 `json:"outgoing_webhooks_count"`
}
type TrueUpReviewPlugins struct {
TotalPlugins int `json:"total_plugins"`
PluginNames []string `json:"plugin_names"`
}
func (t *TrueUpReviewPlugins) ToMap() map[string]interface{} {
return map[string]interface{}{
"total_plugins": t.TotalPlugins,
"plugin_names": strings.Join(t.PluginNames, ","),
}
}
type TrueUpReviewStatus struct {
Completed bool `json:"complete"`
DueDate int64 `json:"due_date"`
}
func (t *TrueUpReviewStatus) ToSlice() []interface{} {
return []interface{}{
t.DueDate,
t.Completed,
}
}