MM-47403: Add hooks to the product (#3962)

We do this to get the changes published
from the server.

https://mattermost.atlassian.net/browse/MM-47403

```release-note
NONE
```
This commit is contained in:
Agniva De Sarker 2022-10-07 16:38:21 +05:30 committed by GitHub
parent c476940781
commit 3025690b08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -25,7 +25,7 @@ const (
var errServiceTypeAssert = errors.New("type assertion failed")
func init() {
app.RegisterProduct("boards", app.ProductManifest{
app.RegisterProduct(boardsProductName, app.ProductManifest{
Initializer: newBoardsProduct,
Dependencies: map[app.ServiceKey]struct{}{
app.TeamKey: {},
@ -68,6 +68,7 @@ type boardsProduct struct {
storeService product.StoreService
systemService product.SystemService
preferencesService product.PreferencesService
hooksService product.HooksService
boardsApp *boards.BoardsApp
}
@ -185,7 +186,12 @@ func newBoardsProduct(_ *app.Server, services map[app.ServiceKey]interface{}) (a
return nil, fmt.Errorf("invalid service key '%s': %w", key, errServiceTypeAssert)
}
boards.preferencesService = preferencesService
case app.HooksKey: // not needed
case app.HooksKey:
hooksService, ok := service.(product.HooksService)
if !ok {
return nil, fmt.Errorf("invalid service key '%s': %w", key, errServiceTypeAssert)
}
boards.hooksService = hooksService
}
}
return boards, nil
@ -207,6 +213,10 @@ func (bp *boardsProduct) Start() error {
model.LogServerInfo(bp.logger)
if err := bp.hooksService.RegisterHooks(boardsProductName, bp); err != nil {
return fmt.Errorf("failed to register hooks: %w", err)
}
bp.boardsApp = boardsApp
if err := bp.boardsApp.Start(); err != nil {
return fmt.Errorf("failed to start Boards service: %w", err)

View file

@ -20,7 +20,7 @@ const manifestStr = `
"support_url": "https://github.com/mattermost/focalboard/issues",
"release_notes_url": "https://github.com/mattermost/focalboard/releases",
"icon_path": "assets/starter-template-icon.svg",
"version": "7.4.0",
"version": "7.5.0",
"min_server_version": "7.2.0",
"server": {
"executables": {