mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
used. Continues #1173, the other direction of the same popup. Importing used to mean one thing: a whole new board, from the full-width page at All Boards. A swimlane's menu now imports a swimlane below that swimlane, a list's menu imports a list after it, and a card's menu imports a card below it, into the board that is already open. "After" is to the RIGHT in English and to the LEFT in Arabic, and that is one rule rather than two. The page carries dir (client/components/main/ layouts.jade), so the board's row of lists mirrors itself and "after in sort order" is already "the other side"; a direction branch in the placement would mirror it twice and put the list back where it started. The reason is written in models/lib/insertPosition.js, next to a negative test, because it looks like a missing branch. Placement is a fraction between the target's sort and the next one's, not a renumbering of every sibling - renumbering is what a board with ten thousand cards cannot afford and what two clients doing it at once get wrong. Several imported items spread evenly through that gap, so a swimlane of ten lists does not arrive with nine of them in the same position. The arithmetic is a pure module and is tested as arithmetic, junk input included. The file is what the export writes, at any scope, and the SAME checkboxes decide what comes in: a document full of comments imported with comments unticked brings the cards and leaves the comments. A .zip is unpacked in the browser and its wekan.json handed to the same method, so there is one import path and not two. Nothing is merged. Everything created is new, with new ids, because an import that half-updated a board would be an edit nobody could undo - importing the same file twice gives two copies, which is at least a thing you can delete. A custom field is matched by NAME, since an id from another board matches nothing here, and a comment comes back under the importing user, because the original author may not exist on this server. Importing WRITES, so unlike the exports beside it in the same popup it asks isBoardMember() rather than isVisibleBy(), the Admin Panel's import switch still applies, the format is checked, and the deadline that bounds a board import bounds this one. A read-only member is not offered it at all. tests/scopedImport.test.cjs covers the placement arithmetic and pins the selection, the write check and the single import path. Thanks to xet7 !