1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-15 23:54:29 +02:00

Copy images when duplicating card/board (#2253)

* copy image for card/board dup

* revert store changes

* revert store changes
This commit is contained in:
Doug Lauder
2022-02-04 17:12:28 -05:00
committed by GitHub
parent 475c96301c
commit 870c56e6b3
4 changed files with 34 additions and 14 deletions

View File

@ -297,7 +297,7 @@ func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) {
return
}
case blockID != "":
block, err = a.app.GetBlockWithID(*container, blockID)
block, err = a.app.GetBlockByID(*container, blockID)
if err != nil {
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
return
@ -440,11 +440,10 @@ func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
session := ctx.Value(sessionContextKey).(*model.Session)
// this query param exists only when creating
// template from board
// this query param exists when creating template from board, or board from template
sourceBoardID := r.URL.Query().Get("sourceBoardID")
if sourceBoardID != "" {
if updateFileIDsErr := a.app.CopyCardFiles(sourceBoardID, blocks); updateFileIDsErr != nil {
if updateFileIDsErr := a.app.CopyCardFiles(sourceBoardID, container.WorkspaceID, blocks); updateFileIDsErr != nil {
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", updateFileIDsErr)
return
}
@ -1460,7 +1459,7 @@ func (a *API) handleCreateSubscription(w http.ResponseWriter, r *http.Request) {
}
// check for valid block
block, err := a.app.GetBlockWithID(*container, sub.BlockID)
block, err := a.app.GetBlockByID(*container, sub.BlockID)
if err != nil || block == nil {
a.errorResponse(w, r.URL.Path, http.StatusBadRequest, "invalid blockID", err)
return