mirror of
https://github.com/hanzoai/team.git
synced 2026-11-01 07:55:31 +00:00
* 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]>
31 lines
997 B
Go
31 lines
997 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package last_accessible_post
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
|
"github.com/mattermost/mattermost/server/v8/channels/jobs"
|
|
)
|
|
|
|
type AppIface interface {
|
|
ComputeLastAccessiblePostTime() error
|
|
}
|
|
|
|
func MakeWorker(jobServer *jobs.JobServer, license *model.License, app AppIface) *jobs.SimpleWorker {
|
|
const workerName = "LastAccessiblePost"
|
|
|
|
isEnabled := func(_ *model.Config) bool {
|
|
// Enable for any license with post history limits (i.e. Entry SKU)
|
|
return license != nil && license.Limits != nil && license.Limits.PostHistory > 0
|
|
}
|
|
execute := func(logger mlog.LoggerIFace, job *model.Job) error {
|
|
defer jobServer.HandleJobPanic(logger, job)
|
|
|
|
return app.ComputeLastAccessiblePostTime()
|
|
}
|
|
worker := jobs.NewSimpleWorker(workerName, jobServer, execute, isEnabled)
|
|
return worker
|
|
}
|