mirror of
https://github.com/wekan/wekan.git
synced 2026-11-05 01:20:07 -05:00
Fix card-from-template created on the templates board (#5798)
When instantiating a card template, the new card was copied with tpl.boardId, which for a template search is the *templates* board (the search source), not the current board. The card still appeared in the target list (the list renders cards by listId, and the templates board is subscribed), but it had boardId = templates board, so clicking it navigated to the templates board instead of opening the card detail. Copy the template into the current board instead (the target list/swimlane were already resolved on the current board), so the new card belongs to the board it is placed on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7f4108c591
commit
097806984b
1 file changed
+10
-1
@@ -943,7 +943,16 @@ Template.searchElementPopup.events({
|
||||
if (tpl.isTemplateSearch) {
|
||||
element.type = 'cardType-card';
|
||||
element.linkedId = '';
|
||||
_id = await element.copy(tpl.boardId, tpl.swimlaneId, tpl.listId);
|
||||
// #5798: instantiate the template into the CURRENT board, not the
|
||||
// templates board. For a template search tpl.boardId is the templates
|
||||
// board (it is the search source), so copying with it created the card
|
||||
// with boardId = templates board. The card still showed in the target
|
||||
// list (the list query is by listId and the templates board is
|
||||
// subscribed), but clicking it navigated to the templates board instead
|
||||
// of opening the card. The target list/swimlane were already resolved on
|
||||
// the current board.
|
||||
const targetBoardId = (Utils.getCurrentBoard() || {})._id || tpl.boardId;
|
||||
_id = await element.copy(targetBoardId, tpl.swimlaneId, tpl.listId);
|
||||
// 1.B Linked card
|
||||
} else {
|
||||
_id = element.link(tpl.boardId, tpl.swimlaneId, tpl.listId);
|
||||
|
||||
Reference in new issue
Block a user