Fix broken master; ensure all product service APIs have correct implementations (#20663)

* fix broken master; ensure all product service APIs are implemented by the structs passed to products

* use zero allocation interface checks
Этот коммит содержится в:
Doug Lauder
2022-07-15 13:20:40 -04:00
коммит произвёл GitHub
родитель d9bd29be33
Коммит 2aaf4cf0fb
17 изменённых файлов: 83 добавлений и 17 удалений

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

@@ -24,12 +24,14 @@ import (
"github.com/mattermost/mattermost-server/v6/app/users"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/plugin"
"github.com/mattermost/mattermost-server/v6/product"
"github.com/mattermost/mattermost-server/v6/shared/i18n"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/store"
"github.com/mattermost/mattermost-server/v6/store/sqlstore"
)
// teamServiceWrapper provides an implementation of `product.TeamService` to be used by products.
type teamServiceWrapper struct {
app AppIface
}
@@ -42,6 +44,9 @@ func (w *teamServiceWrapper) CreateMember(ctx *request.Context, teamID, userID s
return w.app.AddTeamMember(ctx, teamID, userID)
}
// Ensure the wrapper implements the product service.
var _ product.TeamService = (*teamServiceWrapper)(nil)
func (a *App) AdjustTeamsFromProductLimits(teamLimits *model.TeamsLimits) *model.AppError {
maxActiveTeams := *teamLimits.Active
teams, appErr := a.GetAllTeams()