Add threads service
Этот коммит содержится в:
@@ -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"
|
||||
)
|
||||
|
||||
Ссылка в новой задаче
Block a user