1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-09-16 08:56:19 +02:00

Revert dnd (#4294)

* Revert "Fixed bug where boards would move to category of a different team (#4284)"

This reverts commit e075f408d3.

* Revert "Merge branch 'main' into only-explicit-boards-on-default-category"

This reverts commit 7db7e56296, reversing
changes made to 3feda10b6d.

* Revert "DND support for category and boards in LHS (#3964)"

This reverts commit 9918a0b3f8.
This commit is contained in:
Miguel de la Cruz
2022-12-05 21:03:34 +01:00
committed by GitHub
parent 35f681dd75
commit 9fac8f476e
63 changed files with 1921 additions and 4378 deletions

View File

@@ -20,8 +20,6 @@ const (
websocketActionUpdateCategoryBoard = "UPDATE_BOARD_CATEGORY"
websocketActionUpdateSubscription = "UPDATE_SUBSCRIPTION"
websocketActionUpdateCardLimitTimestamp = "UPDATE_CARD_LIMIT_TIMESTAMP"
websocketActionReorderCategories = "REORDER_CATEGORIES"
websocketActionReorderCategoryBoards = "REORDER_CATEGORY_BOARDS"
)
type Store interface {
@@ -38,9 +36,7 @@ type Adapter interface {
BroadcastMemberDelete(teamID, boardID, userID string)
BroadcastConfigChange(clientConfig model.ClientConfig)
BroadcastCategoryChange(category model.Category)
BroadcastCategoryBoardChange(teamID, userID string, blockCategory []*model.BoardCategoryWebsocketData)
BroadcastCategoryBoardChange(teamID, userID string, blockCategory model.BoardCategoryWebsocketData)
BroadcastCardLimitTimestampChange(cardLimitTimestamp int64)
BroadcastSubscriptionChange(teamID string, subscription *model.Subscription)
BroadcastCategoryReorder(teamID, userID string, categoryOrder []string)
BroadcastCategoryBoardsReorder(teamID, userID, categoryID string, boardsOrder []string)
}

View File

@@ -6,10 +6,10 @@ import (
// UpdateCategoryMessage is sent on block updates.
type UpdateCategoryMessage struct {
Action string `json:"action"`
TeamID string `json:"teamId"`
Category *model.Category `json:"category,omitempty"`
BoardCategories []*model.BoardCategoryWebsocketData `json:"blockCategories,omitempty"`
Action string `json:"action"`
TeamID string `json:"teamId"`
Category *model.Category `json:"category,omitempty"`
BoardCategories *model.BoardCategoryWebsocketData `json:"blockCategories,omitempty"`
}
// UpdateBlockMsg is sent on block updates.
@@ -59,16 +59,3 @@ type WebsocketCommand struct {
ReadToken string `json:"readToken"`
BlockIDs []string `json:"blockIds"`
}
type CategoryReorderMessage struct {
Action string `json:"action"`
CategoryOrder []string `json:"categoryOrder"`
TeamID string `json:"teamId"`
}
type CategoryBoardReorderMessage struct {
Action string `json:"action"`
CategoryID string `json:"CategoryId"`
BoardOrder []string `json:"BoardOrder"`
TeamID string `json:"teamId"`
}

View File

@@ -496,68 +496,19 @@ func (pa *PluginAdapter) BroadcastCategoryChange(category model.Category) {
pa.sendUserMessageSkipCluster(websocketActionUpdateCategory, payload, category.UserID)
}
func (pa *PluginAdapter) BroadcastCategoryReorder(teamID, userID string, categoryOrder []string) {
pa.logger.Debug("BroadcastCategoryReorder",
mlog.String("userID", userID),
mlog.String("teamID", teamID),
)
message := CategoryReorderMessage{
Action: websocketActionReorderCategories,
CategoryOrder: categoryOrder,
TeamID: teamID,
}
payload := utils.StructToMap(message)
go func() {
clusterMessage := &ClusterMessage{
Payload: payload,
UserID: userID,
}
pa.sendMessageToCluster("websocket_message", clusterMessage)
}()
pa.sendUserMessageSkipCluster(message.Action, payload, userID)
}
func (pa *PluginAdapter) BroadcastCategoryBoardsReorder(teamID, userID, categoryID string, boardsOrder []string) {
pa.logger.Debug("BroadcastCategoryBoardsReorder",
mlog.String("userID", userID),
mlog.String("teamID", teamID),
mlog.String("categoryID", categoryID),
)
message := CategoryBoardReorderMessage{
Action: websocketActionReorderCategoryBoards,
CategoryID: categoryID,
BoardOrder: boardsOrder,
TeamID: teamID,
}
payload := utils.StructToMap(message)
go func() {
clusterMessage := &ClusterMessage{
Payload: payload,
UserID: userID,
}
pa.sendMessageToCluster("websocket_message", clusterMessage)
}()
pa.sendUserMessageSkipCluster(message.Action, payload, userID)
}
func (pa *PluginAdapter) BroadcastCategoryBoardChange(teamID, userID string, boardCategories []*model.BoardCategoryWebsocketData) {
func (pa *PluginAdapter) BroadcastCategoryBoardChange(teamID, userID string, boardCategory model.BoardCategoryWebsocketData) {
pa.logger.Debug(
"BroadcastCategoryBoardChange",
mlog.String("userID", userID),
mlog.String("teamID", teamID),
mlog.Int("numEntries", len(boardCategories)),
mlog.String("categoryID", boardCategory.CategoryID),
mlog.String("blockID", boardCategory.BoardID),
)
message := UpdateCategoryMessage{
Action: websocketActionUpdateCategoryBoard,
TeamID: teamID,
BoardCategories: boardCategories,
BoardCategories: &boardCategory,
}
payload := utils.StructToMap(message)

View File

@@ -589,80 +589,27 @@ func (ws *Server) BroadcastCategoryChange(category model.Category) {
}
}
func (ws *Server) BroadcastCategoryReorder(teamID, userID string, categoryOrder []string) {
message := CategoryReorderMessage{
Action: websocketActionReorderCategories,
CategoryOrder: categoryOrder,
TeamID: teamID,
}
listeners := ws.getListenersForTeam(teamID)
ws.logger.Debug("listener(s) for teamID",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
)
for _, listener := range listeners {
ws.logger.Debug("Broadcast category order change",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
mlog.Stringer("remoteAddr", listener.conn.RemoteAddr()),
)
if err := listener.WriteJSON(message); err != nil {
ws.logger.Error("broadcast category order change error", mlog.Err(err))
listener.conn.Close()
}
}
}
func (ws *Server) BroadcastCategoryBoardsReorder(teamID, userID, categoryID string, boardOrder []string) {
message := CategoryBoardReorderMessage{
Action: websocketActionReorderCategoryBoards,
CategoryID: categoryID,
BoardOrder: boardOrder,
TeamID: teamID,
}
listeners := ws.getListenersForTeam(teamID)
ws.logger.Debug("listener(s) for teamID",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
)
for _, listener := range listeners {
ws.logger.Debug("Broadcast board category order change",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
mlog.Stringer("remoteAddr", listener.conn.RemoteAddr()),
)
if err := listener.WriteJSON(message); err != nil {
ws.logger.Error("broadcast category order change error", mlog.Err(err))
listener.conn.Close()
}
}
}
func (ws *Server) BroadcastCategoryBoardChange(teamID, userID string, boardCategories []*model.BoardCategoryWebsocketData) {
func (ws *Server) BroadcastCategoryBoardChange(teamID, userID string, boardCategory model.BoardCategoryWebsocketData) {
message := UpdateCategoryMessage{
Action: websocketActionUpdateCategoryBoard,
TeamID: teamID,
BoardCategories: boardCategories,
BoardCategories: &boardCategory,
}
listeners := ws.getListenersForTeam(teamID)
ws.logger.Debug("listener(s) for teamID",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
mlog.Int("numEntries", len(boardCategories)),
mlog.String("categoryID", boardCategory.CategoryID),
mlog.String("blockID", boardCategory.BoardID),
)
for _, listener := range listeners {
ws.logger.Debug("Broadcast block change",
mlog.Int("listener_count", len(listeners)),
mlog.String("teamID", teamID),
mlog.Int("numEntries", len(boardCategories)),
mlog.String("categoryID", boardCategory.CategoryID),
mlog.String("blockID", boardCategory.BoardID),
mlog.Stringer("remoteAddr", listener.conn.RemoteAddr()),
)