You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +02:00
Disable cloud limits (#4268)
* Disable cloud limits * Fix linter * Disable limits initialization and shortcircuit GetBoardsCloudLimits Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bdf3e81b07
commit
fd4cf95f8a
@ -16,7 +16,6 @@ import (
|
|||||||
"github.com/mattermost/focalboard/server/services/store"
|
"github.com/mattermost/focalboard/server/services/store"
|
||||||
"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer"
|
"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer"
|
||||||
"github.com/mattermost/focalboard/server/services/store/sqlstore"
|
"github.com/mattermost/focalboard/server/services/store/sqlstore"
|
||||||
"github.com/mattermost/focalboard/server/utils"
|
|
||||||
"github.com/mattermost/focalboard/server/ws"
|
"github.com/mattermost/focalboard/server/ws"
|
||||||
|
|
||||||
mm_model "github.com/mattermost/mattermost-server/v6/model"
|
mm_model "github.com/mattermost/mattermost-server/v6/model"
|
||||||
@ -147,6 +146,9 @@ func NewBoardsApp(api model.ServicesAPI) (*BoardsApp, error) {
|
|||||||
|
|
||||||
backendParams.appAPI.init(db, server.App())
|
backendParams.appAPI.init(db, server.App())
|
||||||
|
|
||||||
|
// ToDo: Cloud Limits have been disabled by design. We should
|
||||||
|
// revisit the decision and update the related code accordingly
|
||||||
|
/*
|
||||||
if utils.IsCloudLicense(api.GetLicense()) {
|
if utils.IsCloudLicense(api.GetLicense()) {
|
||||||
limits, err := api.GetCloudLimits()
|
limits, err := api.GetCloudLimits()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -157,6 +159,7 @@ func NewBoardsApp(api model.ServicesAPI) (*BoardsApp, error) {
|
|||||||
return nil, fmt.Errorf("error setting cloud limits when starting Boards: %w", err)
|
return nil, fmt.Errorf("error setting cloud limits when starting Boards: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return &BoardsApp{
|
return &BoardsApp{
|
||||||
server: server,
|
server: server,
|
||||||
|
@ -192,6 +192,10 @@ func (a *App) InsertBlockAndNotify(block *model.Block, modifiedByID string, disa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) isWithinViewsLimit(boardID string, block *model.Block) (bool, error) {
|
func (a *App) isWithinViewsLimit(boardID string, block *model.Block) (bool, error) {
|
||||||
|
// ToDo: Cloud Limits have been disabled by design. We should
|
||||||
|
// revisit the decision and update the related code accordingly
|
||||||
|
|
||||||
|
/*
|
||||||
limits, err := a.GetBoardsCloudLimits()
|
limits, err := a.GetBoardsCloudLimits()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -211,6 +215,9 @@ func (a *App) isWithinViewsLimit(boardID string, block *model.Block) (bool, erro
|
|||||||
// That's why we need to check for if existing + the being-created
|
// That's why we need to check for if existing + the being-created
|
||||||
// view doesn't exceed the limit.
|
// view doesn't exceed the limit.
|
||||||
return len(views) < limits.Views, nil
|
return len(views) < limits.Views, nil
|
||||||
|
*/
|
||||||
|
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) InsertBlocks(blocks []*model.Block, modifiedByID string) ([]*model.Block, error) {
|
func (a *App) InsertBlocks(blocks []*model.Block, modifiedByID string) ([]*model.Block, error) {
|
||||||
|
@ -78,6 +78,8 @@ func TestPatchBlocks(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("cloud limit error scenario", func(t *testing.T) {
|
t.Run("cloud limit error scenario", func(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
th.App.SetCardLimit(5)
|
th.App.SetCardLimit(5)
|
||||||
|
|
||||||
fakeLicense := &mmModel.License{
|
fakeLicense := &mmModel.License{
|
||||||
@ -185,6 +187,8 @@ func TestUndeleteBlock(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsWithinViewsLimit(t *testing.T) {
|
func TestIsWithinViewsLimit(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
th, tearDown := SetupTestHelper(t)
|
th, tearDown := SetupTestHelper(t)
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
|
|
||||||
@ -302,6 +306,8 @@ func TestInsertBlocks(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("create view within limits", func(t *testing.T) {
|
t.Run("create view within limits", func(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
boardID := testBoardID
|
boardID := testBoardID
|
||||||
block := &model.Block{
|
block := &model.Block{
|
||||||
Type: model.TypeView,
|
Type: model.TypeView,
|
||||||
@ -334,6 +340,8 @@ func TestInsertBlocks(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("create view exceeding limits", func(t *testing.T) {
|
t.Run("create view exceeding limits", func(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
boardID := testBoardID
|
boardID := testBoardID
|
||||||
block := &model.Block{
|
block := &model.Block{
|
||||||
Type: model.TypeView,
|
Type: model.TypeView,
|
||||||
|
@ -20,6 +20,9 @@ var ErrNilPluginAPI = errors.New("server not running in plugin mode")
|
|||||||
// GetBoardsCloudLimits returns the limits of the server, and an empty
|
// GetBoardsCloudLimits returns the limits of the server, and an empty
|
||||||
// limits struct if there are no limits set.
|
// limits struct if there are no limits set.
|
||||||
func (a *App) GetBoardsCloudLimits() (*model.BoardsCloudLimits, error) {
|
func (a *App) GetBoardsCloudLimits() (*model.BoardsCloudLimits, error) {
|
||||||
|
// ToDo: Cloud Limits have been disabled by design. We should
|
||||||
|
// revisit the decision and update the related code accordingly
|
||||||
|
/*
|
||||||
if !a.IsCloud() {
|
if !a.IsCloud() {
|
||||||
return &model.BoardsCloudLimits{}, nil
|
return &model.BoardsCloudLimits{}, nil
|
||||||
}
|
}
|
||||||
@ -53,6 +56,9 @@ func (a *App) GetBoardsCloudLimits() (*model.BoardsCloudLimits, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return boardsCloudLimits, nil
|
return boardsCloudLimits, nil
|
||||||
|
*/
|
||||||
|
|
||||||
|
return &model.BoardsCloudLimits{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) GetUsedCardsCount() (int, error) {
|
func (a *App) GetUsedCardsCount() (int, error) {
|
||||||
@ -68,7 +74,12 @@ func (a *App) IsCloud() bool {
|
|||||||
// IsCloudLimited returns true if the server is running in cloud mode
|
// IsCloudLimited returns true if the server is running in cloud mode
|
||||||
// and the card limit has been set.
|
// and the card limit has been set.
|
||||||
func (a *App) IsCloudLimited() bool {
|
func (a *App) IsCloudLimited() bool {
|
||||||
return a.CardLimit() != 0 && a.IsCloud()
|
// ToDo: Cloud Limits have been disabled by design. We should
|
||||||
|
// revisit the decision and update the related code accordingly
|
||||||
|
|
||||||
|
// return a.CardLimit() != 0 && a.IsCloud()
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCloudLimits sets the limits of the server.
|
// SetCloudLimits sets the limits of the server.
|
||||||
|
@ -68,6 +68,8 @@ func TestIsCloud(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsCloudLimited(t *testing.T) {
|
func TestIsCloudLimited(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
t.Run("if no limit has been set, it should be false", func(t *testing.T) {
|
t.Run("if no limit has been set, it should be false", func(t *testing.T) {
|
||||||
th, tearDown := SetupTestHelper(t)
|
th, tearDown := SetupTestHelper(t)
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
@ -91,6 +93,8 @@ func TestIsCloudLimited(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSetCloudLimits(t *testing.T) {
|
func TestSetCloudLimits(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
t.Run("if the limits are empty, it should do nothing", func(t *testing.T) {
|
t.Run("if the limits are empty, it should do nothing", func(t *testing.T) {
|
||||||
t.Run("limits empty", func(t *testing.T) {
|
t.Run("limits empty", func(t *testing.T) {
|
||||||
th, tearDown := SetupTestHelper(t)
|
th, tearDown := SetupTestHelper(t)
|
||||||
@ -179,6 +183,8 @@ func TestSetCloudLimits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateCardLimitTimestamp(t *testing.T) {
|
func TestUpdateCardLimitTimestamp(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
fakeLicense := &mmModel.License{
|
fakeLicense := &mmModel.License{
|
||||||
Features: &mmModel.Features{Cloud: mmModel.NewBool(true)},
|
Features: &mmModel.Features{Cloud: mmModel.NewBool(true)},
|
||||||
}
|
}
|
||||||
@ -215,6 +221,8 @@ func TestUpdateCardLimitTimestamp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetTemplateMapForBlocks(t *testing.T) {
|
func TestGetTemplateMapForBlocks(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
t.Run("should fetch the necessary boards from the database", func(t *testing.T) {
|
t.Run("should fetch the necessary boards from the database", func(t *testing.T) {
|
||||||
th, tearDown := SetupTestHelper(t)
|
th, tearDown := SetupTestHelper(t)
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
@ -301,6 +309,8 @@ func TestGetTemplateMapForBlocks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestApplyCloudLimits(t *testing.T) {
|
func TestApplyCloudLimits(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
fakeLicense := &mmModel.License{
|
fakeLicense := &mmModel.License{
|
||||||
Features: &mmModel.Features{Cloud: mmModel.NewBool(true)},
|
Features: &mmModel.Features{Cloud: mmModel.NewBool(true)},
|
||||||
}
|
}
|
||||||
@ -395,6 +405,8 @@ func TestApplyCloudLimits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestContainsLimitedBlocks(t *testing.T) {
|
func TestContainsLimitedBlocks(t *testing.T) {
|
||||||
|
t.Skipf("The Cloud Limits feature has been disabled")
|
||||||
|
|
||||||
// for all the following tests, the timestamp will be set to 150,
|
// for all the following tests, the timestamp will be set to 150,
|
||||||
// which means that blocks with an UpdateAt set to 100 will be
|
// which means that blocks with an UpdateAt set to 100 will be
|
||||||
// outside the active window and possibly limited, and blocks with
|
// outside the active window and possibly limited, and blocks with
|
||||||
|
Reference in New Issue
Block a user