Add threads service
Этот коммит содержится в:
@@ -241,6 +241,8 @@ func NewChannels(services map[product.ServiceKey]any) (*Channels, error) {
|
|||||||
|
|
||||||
services[product.CommandKey] = &App{ch: ch}
|
services[product.CommandKey] = &App{ch: ch}
|
||||||
|
|
||||||
|
services[product.ThreadsKey] = &App{ch: ch}
|
||||||
|
|
||||||
return ch, nil
|
return ch, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
"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
|
// we have a race condition due to multiple plugins calling this method
|
||||||
a.ch.collectionAndTopicTypesMut.Lock()
|
a.ch.collectionAndTopicTypesMut.Lock()
|
||||||
defer a.ch.collectionAndTopicTypesMut.Unlock()
|
defer a.ch.collectionAndTopicTypesMut.Unlock()
|
||||||
|
|||||||
@@ -1235,7 +1235,7 @@ func (api *PluginAPI) GetCloudLimits() (*model.ProductLimits, error) {
|
|||||||
// RegisterCollectionAndTopic informs the server that this plugin handles
|
// RegisterCollectionAndTopic informs the server that this plugin handles
|
||||||
// the given collection and topic types.
|
// the given collection and topic types.
|
||||||
func (api *PluginAPI) RegisterCollectionAndTopic(collectionType, topicType string) error {
|
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) {
|
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)
|
ExecuteCommand(c request.CTX, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
|
||||||
RegisterPluginCommand(pluginID string, command *model.Command) error
|
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"
|
SessionKey ServiceKey = "sessionkey"
|
||||||
FrontendKey ServiceKey = "frontendkey"
|
FrontendKey ServiceKey = "frontendkey"
|
||||||
CommandKey ServiceKey = "commandkey"
|
CommandKey ServiceKey = "commandkey"
|
||||||
|
ThreadsKey ServiceKey = "threadskey"
|
||||||
)
|
)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user