mirror of
https://github.com/mattermost/focalboard.git
synced 2025-02-01 19:14:35 +02:00
Notify changes to root blocks (empty parentID)
This commit is contained in:
parent
983ba4b6eb
commit
972b621d12
@ -221,14 +221,12 @@ func (a *API) handleImport(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, block := range blocks {
|
||||
err := a.app().InsertBlock(block)
|
||||
if err != nil {
|
||||
log.Printf(`ERROR: %v`, r)
|
||||
errorResponse(w, http.StatusInternalServerError, nil)
|
||||
err = a.app().InsertBlocks(blocks)
|
||||
if err != nil {
|
||||
log.Printf(`ERROR: %v`, r)
|
||||
errorResponse(w, http.StatusInternalServerError, nil)
|
||||
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("IMPORT Blocks %d block(s)", len(blocks))
|
||||
|
@ -34,7 +34,8 @@ func (a *App) InsertBlocks(blocks []model.Block) error {
|
||||
blockIDsToNotify = append(blockIDsToNotify, block.ID)
|
||||
}
|
||||
|
||||
if len(block.ParentID) > 0 && !uniqueBlockIDs[block.ParentID] {
|
||||
// ParentID as empty string denotes a block at the root
|
||||
if !uniqueBlockIDs[block.ParentID] {
|
||||
blockIDsToNotify = append(blockIDsToNotify, block.ParentID)
|
||||
}
|
||||
|
||||
|
@ -186,9 +186,7 @@ class Sidebar extends React.Component<Props, State> {
|
||||
<Menu.Text
|
||||
id='import'
|
||||
name={text}
|
||||
onClick={async () => Archiver.importFullArchive(() => {
|
||||
this.forceUpdate()
|
||||
})}
|
||||
onClick={async () => Archiver.importFullArchive()}
|
||||
/>
|
||||
)}
|
||||
</FormattedMessage>
|
||||
|
@ -149,7 +149,8 @@ export default class BoardPage extends React.Component<Props, State> {
|
||||
|
||||
await workspaceTree.sync()
|
||||
const boardIds = workspaceTree.boards.map((o) => o.id)
|
||||
this.workspaceListener.open(boardIds, async (blockId) => {
|
||||
// Listen to boards plus all blocks at root (Empty string for parentId)
|
||||
this.workspaceListener.open(['', ...boardIds], async (blockId) => {
|
||||
Utils.log(`workspaceListener.onChanged: ${blockId}`)
|
||||
this.sync()
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user