API includes sort_order, and WebSocket includes data (#19157)
* API includes sort_order, and WebSocket includes data * Adds sort_order API test * MM-40470: Tests that new WS payload is sent after categories are updated via API. * Update api4/channel_category_test.go Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com> Co-authored-by: Martin Kraft <martin@upspin.org> Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
@@ -4,6 +4,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
@@ -119,6 +120,14 @@ func (a *App) UpdateSidebarCategories(userID, teamID string, categories []*model
|
||||
}
|
||||
|
||||
message := model.NewWebSocketEvent(model.WebsocketEventSidebarCategoryUpdated, teamID, "", userID, nil)
|
||||
|
||||
updatedCategoriesJSON, jsonErr := json.Marshal(updatedCategories)
|
||||
if jsonErr != nil {
|
||||
mlog.Warn("Failed to encode original categories to JSON", mlog.Err(jsonErr))
|
||||
}
|
||||
|
||||
message.Add("updatedCategories", string(updatedCategoriesJSON))
|
||||
|
||||
a.Publish(message)
|
||||
|
||||
a.muteChannelsForUpdatedCategories(userID, updatedCategories, originalCategories)
|
||||
|
||||
Ссылка в новой задаче
Block a user