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

prevent ModifiedBy overwrite

This commit is contained in:
omggga 2023-10-18 13:40:59 +03:00
parent 134422df4d
commit 8071eb874d

View File

@ -200,7 +200,9 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (*mo
if err2 := json.Unmarshal(archiveLine.Data, &board); err2 != nil { if err2 := json.Unmarshal(archiveLine.Data, &board); err2 != nil {
return nil, fmt.Errorf("invalid board in archive line %d: %w", lineNum, err2) return nil, fmt.Errorf("invalid board in archive line %d: %w", lineNum, err2)
} }
if board.ModifiedBy == "" {
board.ModifiedBy = userID board.ModifiedBy = userID
}
board.UpdateAt = now board.UpdateAt = now
board.TeamID = opt.TeamID board.TeamID = opt.TeamID
boardsAndBlocks.Boards = append(boardsAndBlocks.Boards, &board) boardsAndBlocks.Boards = append(boardsAndBlocks.Boards, &board)
@ -224,7 +226,9 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (*mo
if err2 := json.Unmarshal(archiveLine.Data, &block); err2 != nil { if err2 := json.Unmarshal(archiveLine.Data, &block); err2 != nil {
return nil, fmt.Errorf("invalid block in archive line %d: %w", lineNum, err2) return nil, fmt.Errorf("invalid block in archive line %d: %w", lineNum, err2)
} }
if block.ModifiedBy == "" {
block.ModifiedBy = userID block.ModifiedBy = userID
}
block.UpdateAt = now block.UpdateAt = now
block.BoardID = boardID block.BoardID = boardID
boardsAndBlocks.Blocks = append(boardsAndBlocks.Blocks, block) boardsAndBlocks.Blocks = append(boardsAndBlocks.Blocks, block)