MM-40818: Pass filestore to channels (#19677)
We move away from referencing server struct but pass the filestore service to Channels explicitly. https://mattermost.atlassian.net/browse/MM-40818 ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c8eafebecf
Коммит
7664c9d709
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/plugin"
|
||||
"github.com/mattermost/mattermost-server/v6/services/imageproxy"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -48,6 +49,7 @@ type namer interface {
|
||||
type Channels struct {
|
||||
srv *Server
|
||||
cfgSvc configSvc
|
||||
filestore filestore.FileBackend
|
||||
licenseSvc licenseSvc
|
||||
|
||||
postActionCookieSecret []byte
|
||||
@@ -115,6 +117,7 @@ func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, err
|
||||
requiredServices := []ServiceKey{
|
||||
ConfigKey,
|
||||
LicenseKey,
|
||||
FilestoreKey,
|
||||
}
|
||||
for _, svcKey := range requiredServices {
|
||||
svc, ok := services[svcKey]
|
||||
@@ -133,6 +136,12 @@ func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, err
|
||||
return nil, errors.New("Config service does not contain Name method")
|
||||
}
|
||||
ch.cfgSvc = cfgSvc
|
||||
case FilestoreKey:
|
||||
filestore, ok := svc.(filestore.FileBackend)
|
||||
if !ok {
|
||||
return nil, errors.New("Filestore service did not satisfy FileBackend interface")
|
||||
}
|
||||
ch.filestore = filestore
|
||||
case LicenseKey:
|
||||
svc, ok := svc.(licenseSvc)
|
||||
if !ok {
|
||||
|
||||
Ссылка в новой задаче
Block a user