Remove support for unused product interfaces (#24965)
We no longer rely on commands and hooks for products, so simplify this code.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1de790a4fe
Коммит
2ba91e43b6
@@ -51,9 +51,6 @@ type Channels struct {
|
||||
pluginConfigListenerID string
|
||||
pluginClusterLeaderListenerID string
|
||||
|
||||
productCommandsLock sync.RWMutex
|
||||
productCommands []*ProductCommand
|
||||
|
||||
imageProxy *imageproxy.ImageProxy
|
||||
|
||||
// cached counts that are used during notice condition validation
|
||||
@@ -239,10 +236,6 @@ func NewChannels(services map[product.ServiceKey]any) (*Channels, error) {
|
||||
app: &App{ch: ch},
|
||||
}
|
||||
|
||||
services[product.HooksKey] = &hooksService{
|
||||
ch: ch,
|
||||
}
|
||||
|
||||
services[product.UserKey] = &App{ch: ch}
|
||||
|
||||
services[product.PreferencesKey] = &preferencesServiceWrapper{
|
||||
@@ -334,28 +327,10 @@ func (ch *Channels) RequestTrialLicense(requesterID string, users int, termsAcce
|
||||
receiveEmailsAccepted)
|
||||
}
|
||||
|
||||
func (a *App) HooksManager() *product.HooksManager {
|
||||
return a.ch.srv.hooksManager
|
||||
}
|
||||
|
||||
// Ensure hooksService implements `product.HooksService`
|
||||
var _ product.HooksService = (*hooksService)(nil)
|
||||
|
||||
type hooksService struct {
|
||||
ch *Channels
|
||||
}
|
||||
|
||||
func (s *hooksService) RegisterHooks(productID string, hooks any) error {
|
||||
return s.ch.srv.hooksManager.AddProduct(productID, hooks)
|
||||
}
|
||||
|
||||
func (ch *Channels) RunMultiHook(hookRunnerFunc func(hooks plugin.Hooks) bool, hookId int) {
|
||||
if env := ch.GetPluginsEnvironment(); env != nil {
|
||||
env.RunMultiPluginHook(hookRunnerFunc, hookId)
|
||||
}
|
||||
|
||||
// run hook for the products
|
||||
ch.srv.hooksManager.RunMultiHook(hookRunnerFunc, hookId)
|
||||
}
|
||||
|
||||
func (ch *Channels) HooksForPluginOrProduct(id string) (plugin.Hooks, error) {
|
||||
@@ -369,10 +344,5 @@ func (ch *Channels) HooksForPluginOrProduct(id string) (plugin.Hooks, error) {
|
||||
}
|
||||
}
|
||||
|
||||
hooks = ch.srv.hooksManager.HooksForProduct(id)
|
||||
if hooks != nil {
|
||||
return hooks, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("could not find hooks for id %s", id)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user