mirror of
https://github.com/mattermost/mattermost.git
synced 2026-03-03 13:51:38 -05:00
* 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 * Add back translation * Remove client functions * Put back client functions --------- Co-authored-by: Mattermost Build <build@mattermost.com>
36 lines
1,017 B
Go
36 lines
1,017 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
)
|
|
|
|
func (a *App) AdjustInProductLimits(limits *model.ProductLimits, subscription *model.Subscription) *model.AppError {
|
|
if limits.Teams != nil && limits.Teams.Active != nil && *limits.Teams.Active > 0 {
|
|
err := a.AdjustTeamsFromProductLimits(limits.Teams)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Create/ Update a subscription history event
|
|
func (a *App) SendSubscriptionHistoryEvent(userID string) (*model.SubscriptionHistory, error) {
|
|
license := a.Srv().License()
|
|
|
|
// No need to create a Subscription History Event if the license isn't cloud
|
|
if !license.IsCloud() {
|
|
return nil, nil
|
|
}
|
|
|
|
// Get user count
|
|
userCount, err := a.Srv().Store().User().Count(model.UserCountOptions{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return a.Cloud().CreateOrUpdateSubscriptionHistoryEvent(userID, int(userCount))
|
|
}
|