Files
7059a97a10 Message History Limits in Entry Edition (#33831)
* Support for Entry license with limits + updates to Edition & License screen

* Refactor message history limit to use entry sku limits

* Fixed missing update on license change

* Fix typo in limit types

* Revert unnecessary thread change

* Revert merge issue

* Cleanup

* Fix CTAs of limit notifications

* Linting

* More linting

* Linting and fix tests

* More linting

* Fix tests

* PR feedback and fix tests

* Fix tests

* Fix test

* Fix test

* Linting

* Simplified Limit panels

* Linting

* PR feedback

* Revert back job time

* Linting

* linting

* Fixed issue switching in RHS

* PR Feedback

---------

Co-authored-by: Nick Misasi <[email protected]>
Co-authored-by: Mattermost Build <[email protected]>
2025-09-10 22:52:19 -04:00

26 lines
935 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package last_accessible_post
import (
"strconv"
"time"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/v8/channels/jobs"
)
const schedFreq = 30 * time.Minute
func MakeScheduler(jobServer *jobs.JobServer, license *model.License) *jobs.PeriodicScheduler {
isEnabled := func(cfg *model.Config) bool {
// Enable for any license with post history limits (i.e. Entry SKU)
enabled := license != nil && license.Limits != nil && license.Limits.PostHistory > 0
mlog.Debug("Scheduler: isEnabled: "+strconv.FormatBool(enabled), mlog.String("scheduler", model.JobTypeLastAccessiblePost))
return enabled
}
return jobs.NewPeriodicScheduler(jobServer, model.JobTypeLastAccessiblePost, schedFreq, isEnabled)
}