mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-26 18:48:15 +02:00
Broadcasting category changes only to the correct user
This commit is contained in:
parent
0363357209
commit
2358e3e792
@ -400,6 +400,11 @@ func (pa *PluginAdapter) BroadcastConfigChange(pluginConfig model.ClientConfig)
|
|||||||
// with a websocket client subscribed to a given team.
|
// with a websocket client subscribed to a given team.
|
||||||
func (pa *PluginAdapter) sendTeamMessageSkipCluster(event, teamID string, payload map[string]interface{}) {
|
func (pa *PluginAdapter) sendTeamMessageSkipCluster(event, teamID string, payload map[string]interface{}) {
|
||||||
userIDs := pa.getUserIDsForTeam(teamID)
|
userIDs := pa.getUserIDsForTeam(teamID)
|
||||||
|
pa.sendUserMessageSkipCluster(event, payload, userIDs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// sendUserMessageSkipCluster sends the message to specific users.
|
||||||
|
func (pa *PluginAdapter) sendUserMessageSkipCluster(event string, payload map[string]interface{}, userIDs ...string) {
|
||||||
for _, userID := range userIDs {
|
for _, userID := range userIDs {
|
||||||
pa.api.PublishWebSocketEvent(event, payload, &mmModel.WebsocketBroadcast{UserId: userID})
|
pa.api.PublishWebSocketEvent(event, payload, &mmModel.WebsocketBroadcast{UserId: userID})
|
||||||
}
|
}
|
||||||
@ -407,11 +412,12 @@ func (pa *PluginAdapter) sendTeamMessageSkipCluster(event, teamID string, payloa
|
|||||||
|
|
||||||
// sendTeamMessage sends and propagates a message that is aimed
|
// sendTeamMessage sends and propagates a message that is aimed
|
||||||
// for all the users that are subscribed to a given team.
|
// for all the users that are subscribed to a given team.
|
||||||
func (pa *PluginAdapter) sendTeamMessage(event, teamID string, payload map[string]interface{}) {
|
func (pa *PluginAdapter) sendTeamMessage(event, teamID string, payload map[string]interface{}, ensureUserIDs ...string) {
|
||||||
go func() {
|
go func() {
|
||||||
clusterMessage := &ClusterMessage{
|
clusterMessage := &ClusterMessage{
|
||||||
TeamID: teamID,
|
TeamID: teamID,
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
|
EnsureUsers: ensureUserIDs,
|
||||||
}
|
}
|
||||||
|
|
||||||
pa.sendMessageToCluster("websocket_message", clusterMessage)
|
pa.sendMessageToCluster("websocket_message", clusterMessage)
|
||||||
@ -424,9 +430,7 @@ func (pa *PluginAdapter) sendTeamMessage(event, teamID string, payload map[strin
|
|||||||
// subscribed to a given team that belong to one of its boards.
|
// subscribed to a given team that belong to one of its boards.
|
||||||
func (pa *PluginAdapter) sendBoardMessageSkipCluster(teamID, boardID string, payload map[string]interface{}, ensureUserIDs ...string) {
|
func (pa *PluginAdapter) sendBoardMessageSkipCluster(teamID, boardID string, payload map[string]interface{}, ensureUserIDs ...string) {
|
||||||
userIDs := pa.getUserIDsForTeamAndBoard(teamID, boardID, ensureUserIDs...)
|
userIDs := pa.getUserIDsForTeamAndBoard(teamID, boardID, ensureUserIDs...)
|
||||||
for _, userID := range userIDs {
|
pa.sendUserMessageSkipCluster(websocketActionUpdateBoard, payload, userIDs...)
|
||||||
pa.api.PublishWebSocketEvent(websocketActionUpdateBoard, payload, &mmModel.WebsocketBroadcast{UserId: userID})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendBoardMessage sends and propagates a message that is aimed for
|
// sendBoardMessage sends and propagates a message that is aimed for
|
||||||
@ -465,7 +469,7 @@ func (pa *PluginAdapter) BroadcastBlockChange(teamID string, block model.Block)
|
|||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastCategoryChange(category model.Category) {
|
func (pa *PluginAdapter) BroadcastCategoryChange(category model.Category) {
|
||||||
pa.logger.Debug("BroadcastCategoryChange",
|
pa.logger.Debug("BroadcastCategoryChange",
|
||||||
mlog.String("userID", category.TeamID),
|
mlog.String("userID", category.UserID),
|
||||||
mlog.String("teamID", category.TeamID),
|
mlog.String("teamID", category.TeamID),
|
||||||
mlog.String("categoryID", category.ID),
|
mlog.String("categoryID", category.ID),
|
||||||
)
|
)
|
||||||
@ -476,7 +480,7 @@ func (pa *PluginAdapter) BroadcastCategoryChange(category model.Category) {
|
|||||||
Category: &category,
|
Category: &category,
|
||||||
}
|
}
|
||||||
|
|
||||||
pa.sendTeamMessage(websocketActionUpdateCategory, category.TeamID, utils.StructToMap(message))
|
pa.sendUserMessageSkipCluster(websocketActionUpdateCategory, utils.StructToMap(message), category.UserID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastCategoryBlockChange(teamID, userID string, blockCategory model.BlockCategoryWebsocketData) {
|
func (pa *PluginAdapter) BroadcastCategoryBlockChange(teamID, userID string, blockCategory model.BlockCategoryWebsocketData) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user