1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Restricted scope of board-category change WS event to correct user (#3594)

This commit is contained in:
Harshil Sharma 2022-08-10 16:14:37 +05:30 committed by GitHub
parent 3b099bada4
commit 08c66fbeed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -486,8 +486,8 @@ func (pa *PluginAdapter) BroadcastCategoryChange(category model.Category) {
go func() {
clusterMessage := &ClusterMessage{
Payload: payload,
EnsureUsers: []string{category.UserID},
Payload: payload,
UserID: category.UserID,
}
pa.sendMessageToCluster("websocket_message", clusterMessage)
@ -511,7 +511,18 @@ func (pa *PluginAdapter) BroadcastCategoryBoardChange(teamID, userID string, boa
BoardCategories: &boardCategory,
}
pa.sendTeamMessage(websocketActionUpdateCategoryBoard, teamID, utils.StructToMap(message))
payload := utils.StructToMap(message)
go func() {
clusterMessage := &ClusterMessage{
Payload: payload,
UserID: userID,
}
pa.sendMessageToCluster("websocket_message", clusterMessage)
}()
pa.sendUserMessageSkipCluster(websocketActionUpdateCategoryBoard, utils.StructToMap(message), userID)
}
func (pa *PluginAdapter) BroadcastBlockDelete(teamID, blockID, boardID string) {

View File

@ -10,6 +10,7 @@ import (
type ClusterMessage struct {
TeamID string
BoardID string
UserID string
Payload map[string]interface{}
EnsureUsers []string
}
@ -69,5 +70,10 @@ func (pa *PluginAdapter) HandleClusterEvent(ev mmModel.PluginClusterEvent) {
return
}
if clusterMessage.UserID != "" {
pa.sendUserMessageSkipCluster(action, clusterMessage.Payload, clusterMessage.UserID)
return
}
pa.sendTeamMessageSkipCluster(action, clusterMessage.TeamID, clusterMessage.Payload)
}