Merge branch 'master' into mpa-playbooks

Этот коммит содержится в:
Giorgi Bochorishvili
2023-01-23 17:16:56 +04:00
родитель 4bdc49d11d f76d240495
Коммит 48e475a644
75 изменённых файлов: 1637 добавлений и 318 удалений

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

@@ -8700,6 +8700,17 @@ func (c *Client4) AddUserToGroupSyncables(userID string) (*Response, error) {
return BuildResponse(r), nil
}
func (c *Client4) CheckCWSConnection(userId string) (*Response, error) {
r, err := c.DoAPIGet(c.cloudRoute()+"/healthz", "")
if err != nil {
return BuildResponse(r), err
}
defer closeBody(r)
return BuildResponse(r), nil
}
// Worktemplates sections
func (c *Client4) worktemplatesRoute() string {

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

@@ -4,6 +4,7 @@
package model
import (
"encoding/json"
"strings"
)
@@ -260,11 +261,18 @@ type FailedPayment struct {
type CloudWorkspaceOwner struct {
UserName string `json:"username"`
}
type SubscriptionChange struct {
ProductID string `json:"product_id"`
Seats int `json:"seats"`
ProductID string `json:"product_id"`
Seats int `json:"seats"`
DowngradeFeedback *DowngradeFeedback `json:"downgrade_feedback"`
}
// TODO remove BoardsLimits.
// It is not used for real.
// Focalboard has some lingering code using this struct
// https://github.com/mattermost/focalboard/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86
// we should remove this struct once that code is removed.
type BoardsLimits struct {
Cards *int `json:"cards"`
Views *int `json:"views"`
@@ -274,10 +282,6 @@ type FilesLimits struct {
TotalStorage *int64 `json:"total_storage"`
}
type IntegrationsLimits struct {
Enabled *int `json:"enabled"`
}
type MessagesLimits struct {
History *int `json:"history"`
}
@@ -287,11 +291,15 @@ type TeamsLimits struct {
}
type ProductLimits struct {
Boards *BoardsLimits `json:"boards,omitempty"`
Files *FilesLimits `json:"files,omitempty"`
Integrations *IntegrationsLimits `json:"integrations,omitempty"`
Messages *MessagesLimits `json:"messages,omitempty"`
Teams *TeamsLimits `json:"teams,omitempty"`
// TODO remove Boards property.
// It is not used for real.
// Focalboard has some lingering code using this property
// https://github.com/mattermost/focalboard/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86
// we should remove this property once that code is removed.
Boards *BoardsLimits `json:"boards,omitempty"`
Files *FilesLimits `json:"files,omitempty"`
Messages *MessagesLimits `json:"messages,omitempty"`
Teams *TeamsLimits `json:"teams,omitempty"`
}
// CreateSubscriptionRequest is the parameters for the API request to create a subscription.
@@ -304,6 +312,11 @@ type CreateSubscriptionRequest struct {
DiscountID string `json:"discount_id"`
}
type DowngradeFeedback struct {
Reason string `json:"reason"`
Comments string `json:"comments"`
}
func (p *Product) IsYearly() bool {
return p.RecurringInterval == RecurringIntervalYearly
}
@@ -311,3 +324,18 @@ func (p *Product) IsYearly() bool {
func (p *Product) IsMonthly() bool {
return p.RecurringInterval == RecurringIntervalMonthly
}
func (df *DowngradeFeedback) ToMap() map[string]any {
var res map[string]any
feedback, err := json.Marshal(df)
if err != nil {
return res
}
err = json.Unmarshal(feedback, &res)
if err != nil {
return res
}
return res
}

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

@@ -385,7 +385,6 @@ type ServiceSettings struct {
EnableCustomGroups *bool `access:"site_users_and_teams"`
SelfHostedPurchase *bool `access:"write_restrictable,cloud_restrictable"`
AllowSyncedDrafts *bool `access:"site_posts"`
ExperimentalMaxUserPreferences *int
}
func (s *ServiceSettings) SetDefaults(isUpdate bool) {
@@ -858,10 +857,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
if s.SelfHostedPurchase == nil {
s.SelfHostedPurchase = NewBool(true)
}
if s.ExperimentalMaxUserPreferences == nil {
s.ExperimentalMaxUserPreferences = NewInt(1000)
}
}
type ClusterSettings struct {

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

@@ -39,6 +39,15 @@ 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"`

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

@@ -18,8 +18,6 @@ const (
PaidFeaturePlaybooksRetrospective = MattermostPaidFeature("mattermost.feature.playbooks_retro")
PaidFeatureUnlimitedMessages = MattermostPaidFeature("mattermost.feature.unlimited_messages")
PaidFeatureUnlimitedFileStorage = MattermostPaidFeature("mattermost.feature.unlimited_file_storage")
PaidFeatureUnlimitedIntegrations = MattermostPaidFeature("mattermost.feature.unlimited_integrations")
PaidFeatureUnlimitedBoardcards = MattermostPaidFeature("mattermost.feature.unlimited_board_cards")
PaidFeatureAllProfessionalfeatures = MattermostPaidFeature("mattermost.feature.all_professional")
PaidFeatureAllEnterprisefeatures = MattermostPaidFeature("mattermost.feature.all_enterprise")
UpgradeDowngradedWorkspace = MattermostPaidFeature("mattermost.feature.upgrade_downgraded_workspace")
@@ -39,8 +37,6 @@ var paidFeatures map[MattermostPaidFeature]struct{} = map[MattermostPaidFeature]
PaidFeaturePlaybooksRetrospective: {},
PaidFeatureUnlimitedMessages: {},
PaidFeatureUnlimitedFileStorage: {},
PaidFeatureUnlimitedIntegrations: {},
PaidFeatureUnlimitedBoardcards: {},
PaidFeatureAllProfessionalfeatures: {},
PaidFeatureAllEnterprisefeatures: {},
UpgradeDowngradedWorkspace: {},

45
model/true_up_review_profile.go Обычный файл
Просмотреть файл

@@ -0,0 +1,45 @@
// 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"`
ActiveUsers int64 `json:"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,
}
}

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

@@ -13,6 +13,7 @@ import (
// It should be maintained in chronological order with most current
// release at the front of the list.
var versions = []string{
"7.8.0",
"7.7.0",
"7.6.0",
"7.5.0",