Этот коммит содержится в:
Giorgi Bochorishvili
2022-12-29 13:38:38 +04:00
родитель 376d134290
Коммит a57beb229c
5 изменённых файлов: 12 добавлений и 2 удалений

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

@@ -241,6 +241,8 @@ func NewChannels(services map[product.ServiceKey]any) (*Channels, error) {
services[product.CommandKey] = &App{ch: ch}
services[product.ThreadsKey] = &App{ch: ch}
return ch, nil
}

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

@@ -10,7 +10,7 @@ import (
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (a *App) registerCollectionAndTopic(pluginID, collectionType, topicType string) error {
func (a *App) RegisterCollectionAndTopic(pluginID, collectionType, topicType string) error {
// we have a race condition due to multiple plugins calling this method
a.ch.collectionAndTopicTypesMut.Lock()
defer a.ch.collectionAndTopicTypesMut.Unlock()

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

@@ -1235,7 +1235,7 @@ func (api *PluginAPI) GetCloudLimits() (*model.ProductLimits, error) {
// RegisterCollectionAndTopic informs the server that this plugin handles
// the given collection and topic types.
func (api *PluginAPI) RegisterCollectionAndTopic(collectionType, topicType string) error {
return api.app.registerCollectionAndTopic(api.id, collectionType, topicType)
return api.app.RegisterCollectionAndTopic(api.id, collectionType, topicType)
}
func (api *PluginAPI) CreateUploadSession(us *model.UploadSession) (*model.UploadSession, error) {

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

@@ -254,3 +254,10 @@ type CommandService interface {
ExecuteCommand(c request.CTX, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
RegisterPluginCommand(pluginID string, command *model.Command) error
}
// ThreadsService is the API for interacting with threads anywhere.
//
// The service shall be registered via app.ThreadsKey service key.
type ThreadsService interface {
RegisterCollectionAndTopic(productID string, collectionType, topicType string) error
}

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

@@ -29,4 +29,5 @@ const (
SessionKey ServiceKey = "sessionkey"
FrontendKey ServiceKey = "frontendkey"
CommandKey ServiceKey = "commandkey"
ThreadsKey ServiceKey = "threadskey"
)