Compare commits

...
7 Commits
Author SHA1 Message Date
github-actions[bot] 360387890f Bump versions for v13.20 2026-11-19 21:01:49 +00:00
Lauri Ojansivu faf12ea1d5 Prepare v13.20 release 2026-11-19 23:00:47 +02:00
Lauri Ojansivu 114fb7f235 Merge remote-tracking branch 'origin/main' 2026-11-19 23:00:22 +02:00
Lauri Ojansivu 1933025bc8 Update WeKan changelog: build.sh and build.bat run a single Playwright spec.
Thanks to xet7 !
2026-11-19 22:41:56 +02:00
Lauri Ojansivu e1d6ad77c0 build.sh, build.bat: Tests -> Playwright single spec.
Runs one Playwright spec, found by its file name or a part of it, on the
browsers chosen, optionally only the tests whose title matches. Also
./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [filter].

A WeKan already answering on :3000 is used as it is. Otherwise a fresh
bundle is built and the test server started the way the whole-suite runs
start it (Meteor's mongod on :3001, the bundle on :3000), and both are
stopped afterwards, so a single spec does not pass or fail on a stale
bundle. In build.sh each browser runs natively when it can launch and in
the Playwright container when it cannot; Chromium in the VSCodium Flatpak
on arm64 runs natively without Docker. Logs go to
.tools/log/test-playwright-spec/<datetime>/.

Thanks to xet7 !
2026-11-19 22:41:33 +02:00
Lauri Ojansivu 3569b3795f Update WeKan changelog: REST card lists carry the fields for syncing.
Thanks to rmb82 and xet7 !
2026-11-19 22:11:14 +02:00
Lauri Ojansivu 97809cbb33 REST: list and swimlane card lists carry modifiedAt, labelIds, members and customFields.
GET /api/boards/:boardId/lists/:listId/cards and
GET /api/boards/:boardId/swimlanes/:swimlaneId/cards now also return each
card's modifiedAt, dateLastActivity, labelIds, members and customFields
([{ _id, value }]), so a syncing client can skip unchanged cards instead
of a GET per card. Both routes build their items in
models/lib/restCardListItem.js, so they stay alike.

Same board access check, and no extra query. Admin-only custom field
values stay concealed by sendJsonResult's redaction, as on the single-card
GET; each item carries its boardId so that redaction is scoped to this
board, and an admin of it still reads a field shared with other boards.

Thanks to rmb82 and xet7 !

Fixes #6928,
2026-11-19 22:10:43 +02:00
22 changed files with 763 additions and 59 deletions

No files matched your search

+57
View File
@@ -95,6 +95,63 @@ Which databases WeKan supports
</details>
# v13.20 2026-11-19 WeKan ® release
**In short:** The **REST API** card lists of a list and of a swimlane now carry
what a syncing client needs - when a card changed, its labels, members and
custom field values - so syncing a board needs no request per card. **build.sh**
and **build.bat** can run a single **Playwright** spec.
This release adds the following new features:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/97809cbb3373400992766826aa49349cf89539b7">REST API: the card lists of a list and of a swimlane carry modifiedAt, labelIds, members and customFields</a>. Thanks to rmb82 and xet7.</summary>
`GET /api/boards/:boardId/lists/:listId/cards` and
`GET /api/boards/:boardId/swimlanes/:swimlaneId/cards` returned only the
title, description, placement, dates, assignees and sort of each card. A client
keeping a copy of a dozen boards ([#6928](https://github.com/wekan/wekan/issues/6928))
had to GET every card on its own to learn its labels, members or custom field
values, or whether it had changed. Each item now also has `modifiedAt`,
`dateLastActivity`, `labelIds`, `members` and `customFields`
(`[{ _id, value }]`), and both routes build it in
`models/lib/restCardListItem.js`, so they stay alike. The board access check
is the same and there is no extra query. An admin-only custom field's value is
still `null` for a member who is not a board admin, through the same
redaction as the single-card GET. Each item carries its `boardId` so that
redaction is scoped to this board, and an admin of it still reads a field
shared with other boards. `tests/restCardListFields.test.cjs` pins the fields,
that nothing else of the card is added, and the concealment;
`tests/playwright/specs/rest-card-list-fields.e2e.js` checks both routes
against a running server, as a board admin and as a member.
</details>
and adds the following developer tooling:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/e1d6ad77c0c0c687b74d930b9d361d422891ccb8">build.sh and build.bat: Tests -> Playwright single spec runs one spec on the browsers you choose</a>. Thanks to xet7.</summary>
Running one Playwright spec used to mean starting a server by hand and calling
Playwright with the right environment, or running a whole suite. The new Tests
menu option, and `./build.sh --playwright-spec <spec>
[chromium|firefox|webkit|all]
[title filter]`, find the spec by its file name or a part of it. A WeKan
already answering on `:3000` is used as it is. Otherwise a fresh bundle is built
and the test server started the way the whole-suite runs start it, and stopped
afterwards, so a single spec does not pass or fail on a stale bundle. Each
browser runs natively when it can launch and in the Playwright container when
it cannot; Chromium in the VSCodium Flatpak on arm64 runs natively. Logs go to
`.tools/log/test-playwright-spec/<datetime>/`.
`tests/playwrightSingleSpec.test.cjs` checks how a spec is found, that a wrong
spec or browser is refused before anything is built, and that both menus start
and stop the same server.
</details>
Thanks to above GitHub users for their contributions and translators for their
translations.
# v13.19 2026-11-19 WeKan ® release
**In short:** **Release builds** no longer fail when the **Snap Store** is slow
+9 -10
View File
@@ -5,6 +5,15 @@ each one changed and the project status are in
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
make changes there.
# v13.20 2026-11-19 WeKan ® release
The **REST API** card lists of a list and of a swimlane now carry
what a syncing client needs - when a card changed, its labels, members and
custom field values - so syncing a board needs no request per card. **build.sh**
and **build.bat** can run a single **Playwright** spec.
[All changes in v13.20](CHANGELOG-big.md#v1320-2026-11-19-wekan--release)
# v13.19 2026-11-19 WeKan ® release
**Release builds** no longer fail when the **Snap Store** is slow
@@ -43,13 +52,3 @@ server no longer runs out of memory in the hourly **History integrity audit**,
clearing a card's text work again.
[All changes in v13.16](CHANGELOG-big.md#v1316-2026-11-19-wekan--release)
# v13.15 2026-11-18 WeKan ® release
**RaceBleed** is fixed: deleting a card while somebody moves it
to another board no longer destroys its checklists, comments and attachments
while the card itself survives there, and a member deleting a card that was
just moved keeps their account. REST handlers now answer **404, not 500**, for
a swimlane, user or board that is not there.
[All changes in v13.15](CHANGELOG-big.md#v1315-2026-11-18-wekan--release)
+1 -1
View File
@@ -38,7 +38,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
ARG TARGETARCH
ARG TARGETVARIANT
ARG VERSION=13.19
ARG VERSION=13.20
ARG DEBIAN_FRONTEND=noninteractive
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
+1 -1
View File
@@ -1,5 +1,5 @@
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
appVersion: "v13.19.0"
appVersion: "v13.20.0"
files:
userUploads:
- README.md
+84
View File
@@ -203,6 +203,8 @@ echo glab login ^(only scratch items it creates and removes^) and the API
echo imports, read only ^(releases\live-tests\README.md^)
echo 18^) Database speed test: the common WeKan queries on every database with an
echo image for this CPU, compared, written to SpeedTest\Results.md
echo 19^) Playwright single spec: one spec on the browsers you choose; builds and
echo starts the test server when none is running on :3000
set "choice="
set /p "choice=Choose: "
if "%choice%"=="1" goto test_everything_two
@@ -223,6 +225,7 @@ if "%choice%"=="15" goto test_ferretdb
if "%choice%"=="16" goto test_everything_source
if "%choice%"=="17" goto test_live
if "%choice%"=="18" goto test_db_speed
if "%choice%"=="19" goto test_pw_spec
if "%choice%"=="0" goto menu
goto menu_tests
@@ -1532,6 +1535,87 @@ set "WEKAN_PLAYWRIGHT_PROJECT=%PW_PROJECT%"
call meteor npm exec playwright test -- --project=%PW_PROJECT% 2>&1 | powershell -NoProfile -Command "$input | Tee-Object -FilePath '%ONELOG%'; exit $LASTEXITCODE"
goto end
REM ===========================================================================
:test_pw_spec
REM Parity with build.sh's "Playwright single spec" (run_playwright_spec): one
REM spec, chosen by file name or a part of it, on the browsers you choose. A
REM WeKan already answering on :3000 is used as it is; otherwise a fresh bundle
REM is built and the test server started as the whole-suite runs do, and
REM stopped again afterwards. Logs in .tools\log\test-playwright-spec\.
set "PW_SPEC="
set /p "PW_SPEC=Spec file or part of its name (e.g. feature-profiles): "
if not defined PW_SPEC goto menu_tests
set "PW_MATCH=" & set "PW_COUNT=0"
for /f "delims=" %%f in ('dir /b "%REPO%\tests\playwright\specs\*.js" ^| findstr /i /l /c:"%PW_SPEC%"') do (
set /a PW_COUNT+=1
set "PW_MATCH=%%f"
echo %%f
)
if "%PW_COUNT%"=="0" (
echo No spec under tests\playwright\specs matches "%PW_SPEC%".
goto test_pw_spec
)
if not "%PW_COUNT%"=="1" (
echo Several specs match - type more of the name.
goto test_pw_spec
)
echo Spec: specs/%PW_MATCH%
echo Browser: 1^) chromium 2^) firefox 3^) webkit 4^) all
set "PW_B="
set /p "PW_B=Choose [1]: "
set "PW_BROWSERS=chromium"
if "%PW_B%"=="2" set "PW_BROWSERS=firefox"
if "%PW_B%"=="3" set "PW_BROWSERS=webkit"
if "%PW_B%"=="4" set "PW_BROWSERS=chromium firefox webkit"
set "PW_GREP="
set /p "PW_GREP=Only the tests whose title contains (empty = the whole spec): "
call :logdir test-playwright-spec
if errorlevel 1 goto end
set "RUN_LOGDIR=%LOG_DIRECTORY%"
if not exist "%RUN_LOGDIR%" md "%RUN_LOGDIR%"
echo Logs: %RUN_LOGDIR%\
set "PW_STARTED=0"
curl -fsS http://127.0.0.1:3000/sign-in >nul 2>&1
if not errorlevel 1 (
echo ==^> Using the WeKan already running on http://localhost:3000 ^(not started or stopped here^).
echo It runs whatever code it was started with: after changing the source, stop it and run this again.
goto test_pw_spec_run
)
set "PW_BUILD="
set /p "PW_BUILD=Nothing answers on :3000. Build a fresh bundle and start the test server? [Y/n] "
if /i "%PW_BUILD%"=="n" goto end
call :rebuild_for_tests
if errorlevel 1 goto end
call :start_bundle_server
if errorlevel 1 goto end
set "PW_STARTED=1"
if not "!SERVER_READY!"=="1" (
echo ERROR: the test server did not answer on :3000 ^(see %RUN_LOGDIR%\wekan-test-server.log^).
call :stop_test_databases
goto end
)
:test_pw_spec_run
set "PW_RESULT="
for %%b in (%PW_BROWSERS%) do (
echo ==^> Playwright %%b: specs/%PW_MATCH%
pushd "%REPO%\tests\playwright"
set "WEKAN_PLAYWRIGHT_ALL=1"
set "WEKAN_PLAYWRIGHT_PROJECT=%%b"
if defined PW_GREP (
call meteor npm exec playwright test -- --project=%%b --output=test-results\spec-%%b --reporter=list "specs/%PW_MATCH%" --grep "%PW_GREP%" > "%RUN_LOGDIR%\wekan-playwright-%%b.log" 2>&1
) else (
call meteor npm exec playwright test -- --project=%%b --output=test-results\spec-%%b --reporter=list "specs/%PW_MATCH%" > "%RUN_LOGDIR%\wekan-playwright-%%b.log" 2>&1
)
if errorlevel 1 (set "PW_RESULT=!PW_RESULT! FAIL:%%b") else (set "PW_RESULT=!PW_RESULT! PASS:%%b")
popd
type "%RUN_LOGDIR%\wekan-playwright-%%b.log"
)
if "%PW_STARTED%"=="1" call :stop_test_databases
echo.
echo ===== specs/%PW_MATCH% =====
for %%r in (!PW_RESULT!) do echo %%r
goto end
REM ===========================================================================
:test_pw_parallel
echo Running Chromium, Firefox and WebKit Playwright suites sequentially (one browser at a time).
+190
View File
@@ -1127,6 +1127,185 @@ function run_playwright_single(){
return "${PIPESTATUS[0]}"
}
# ---------------------------------------------------------------------------
# One Playwright spec, on the browsers you choose.
#
# ./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [title filter]
# or Tests -> "Playwright single spec" (asks the same three things).
#
# <spec> is a file under tests/playwright/specs or a part of its name
# ("feature-profiles" finds specs/feature-profiles.e2e.js). The title filter is
# Playwright's --grep. When something already answers on :3000 it is used as it
# is; otherwise this builds a fresh bundle and starts the test server exactly
# like the whole-suite runs do (Meteor's mongod on :3001, the bundle on :3000),
# and stops both when the spec is done. Each browser runs natively when it can
# launch here and in the official Playwright container when it cannot (the
# same choice as run_pw_all_browser). Logs in .tools/log/test-playwright-spec/.
# ---------------------------------------------------------------------------
# The spec files matching $1, relative to tests/playwright, one per line.
function playwright_specs_matching(){
local want="${1#tests/playwright/}"
want="${want#specs/}"
local dir="$WEKAN_DIR/tests/playwright/specs"
if [ -n "$want" ] && [ -f "$dir/$want" ]; then
echo "specs/$want"; return 0
fi
( cd "$WEKAN_DIR/tests/playwright" && find specs -name '*.js' | sort | grep -F -- "$want" )
}
# Start the test server the way run_all_tests does, unless one answers already.
# Sets SPEC_SERVER_PID / SPEC_MONGOD_PID for the processes it started.
function start_spec_test_server(){
local logdir="$1" build="$2"
SPEC_SERVER_PID=""; SPEC_MONGOD_PID=""
if curl -fsS --max-time 3 -o /dev/null http://localhost:3000/sign-in 2>/dev/null; then
echo "==> Using the WeKan already running on http://localhost:3000 (not started or stopped here)."
echo " It runs whatever code it was started with: after changing the source, stop it"
echo " and run this again, so a fresh bundle is built."
return 0
fi
if [ "$build" = ask ]; then
local ans
read -r -p "Nothing answers on :3000. Build a fresh bundle and start the test server? [Y/n] " ans
case "$ans" in [Nn]*) echo "Nothing to test against."; return 1 ;; esac
fi
echo "==> Building WeKan, so the spec runs against the current source."
build_wekan || return 1
BUNDLE_DIR=".build/bundle"
NODE_BIN="$(meteor node -e 'process.stdout.write(process.execPath)' 2>/dev/null)"
local MONGOD_BIN=""
[ -n "$NODE_BIN" ] && MONGOD_BIN="$(dirname "$(dirname "$NODE_BIN")")/mongodb/bin/mongod"
[ -x "$MONGOD_BIN" ] || MONGOD_BIN="$(command -v mongod)"
[ -x "$NODE_BIN" ] || NODE_BIN="$(command -v node)"
if [ ! -d "$BUNDLE_DIR/programs/server/node_modules" ]; then
( cd "$BUNDLE_DIR/programs/server" && meteor npm install ) >> "$logdir/wekan-test-server.log" 2>&1 || {
echo "ERROR: npm install in $BUNDLE_DIR/programs/server failed (see $logdir/wekan-test-server.log)."; return 1; }
fi
local port="${WEKAN_TEST_DB_PORT:-3001}"
export WEKAN_MONGO_URL="mongodb://127.0.0.1:$port/meteor"
if mongo_answers "$port"; then
echo "==> Reusing the MongoDB already answering on :$port."
elif (exec 3<>/dev/tcp/127.0.0.1/"$port") 2>/dev/null; then
echo "ERROR: :$port is taken by something that does not answer as MongoDB. Set WEKAN_TEST_DB_PORT."; return 1
else
[ -x "$MONGOD_BIN" ] || { echo "ERROR: no mongod found (Meteor's dev_bundle or PATH)."; return 1; }
local dbpath="$WEKAN_DIR/.tools/mongodb-test-$port" i
mkdir -p "$dbpath"
"$MONGOD_BIN" --port "$port" --dbpath "$dbpath" --bind_ip 127.0.0.1 --nounixsocket > "$logdir/wekan-test-mongod.log" 2>&1 &
SPEC_MONGOD_PID=$!
for i in $(seq 1 60); do mongo_answers "$port" && break; sleep 1; done
mongo_answers "$port" || { echo "ERROR: MongoDB did not start on :$port (see $logdir/wekan-test-mongod.log)."; return 1; }
fi
local writable="$WEKAN_DIR/.tools/test-writable"
mkdir -p "$writable/files"
export WEKAN_FILES_PATH="$writable/files" WEKAN_FILES_PATH_HOST="$writable/files"
echo "==> Starting the WeKan test server on http://localhost:3000 (log: $logdir/wekan-test-server.log)."
MONGO_URL="$WEKAN_MONGO_URL" ROOT_URL="http://localhost:3000" PORT=3000 \
WRITABLE_PATH="$writable" WITH_API=true \
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" \
NODE_OPTIONS="${WEKAN_TEST_NODE_OPTIONS:---max-old-space-size=4096}" \
"$NODE_BIN" "$BUNDLE_DIR/main.js" >> "$logdir/wekan-test-server.log" 2>&1 &
SPEC_SERVER_PID=$!
local i
for i in $(seq 1 300); do
curl -fsS --max-time 2 -o /dev/null http://localhost:3000/sign-in 2>/dev/null && { echo "==> Server is up."; return 0; }
kill -0 "$SPEC_SERVER_PID" 2>/dev/null || break
sleep 1
done
echo "ERROR: the test server did not answer on :3000. Last lines of its log:"
tail -n 30 "$logdir/wekan-test-server.log"
return 1
}
function stop_spec_test_server(){
[ -n "${SPEC_SERVER_PID:-}" ] && kill "$SPEC_SERVER_PID" 2>/dev/null && wait "$SPEC_SERVER_PID" 2>/dev/null
[ -n "${SPEC_MONGOD_PID:-}" ] && kill "$SPEC_MONGOD_PID" 2>/dev/null && wait "$SPEC_MONGOD_PID" 2>/dev/null
SPEC_SERVER_PID=""; SPEC_MONGOD_PID=""
}
# run_playwright_spec [spec] [browser] [title filter] - asks for what is missing
# when run from the menu (interactive), and builds without asking from --playwright-spec.
function run_playwright_spec(){
local spec="${1:-}" browser="${2:-}" grep="${3:-}" mode="${4:-ask}"
if [ -z "$spec" ]; then
read -r -p "Spec file or part of its name (e.g. feature-profiles): " spec
fi
local matches
matches="$(playwright_specs_matching "$spec")"
if [ -z "$matches" ]; then
echo "ERROR: no spec under tests/playwright/specs matches '$spec'."; return 1
fi
if [ "$(printf '%s\n' "$matches" | wc -l)" -gt 1 ]; then
if [ "$mode" != ask ]; then
echo "ERROR: '$spec' matches several specs - name one:"; printf ' %s\n' $matches; return 1
fi
echo "Several specs match '$spec':"
local pick
select pick in $matches; do [ -n "$pick" ] && break; done
matches="$pick"
fi
spec="$matches"
if [ -z "$browser" ]; then
echo "Which browser?"
select browser in chromium firefox webkit all; do [ -n "$browser" ] && break; done
fi
case "$browser" in chromium|firefox|webkit) local browsers=("$browser") ;;
all) local browsers=(chromium firefox webkit) ;;
*) echo "ERROR: browser must be chromium, firefox, webkit or all (got '$browser')."; return 2 ;;
esac
if [ -z "$grep" ] && [ "$mode" = ask ]; then
read -r -p "Only the tests whose title contains (empty = the whole spec): " grep
fi
local args=("$spec")
[ -n "$grep" ] && args+=(--grep "$grep")
local logdir
logdir="$(log_directory test-playwright-spec)" || return $?
mkdir -p "$logdir"; logdir="$(cd "$logdir" && pwd)"
echo "Spec: $spec Browsers: ${browsers[*]}${grep:+ Title filter: $grep}"
echo "Logs: $logdir/"
ensure_playwright_test_dependencies || return 1
start_spec_test_server "$logdir" "$mode" || { stop_spec_test_server; return 1; }
local pwdir="$WEKAN_DIR/tests/playwright" b rc=0 one results=()
for b in "${browsers[@]}"; do
local log="$logdir/wekan-playwright-$b.log"
# Docker where this platform wants it or the native browser cannot start;
# native where Docker is missing but the browser starts (Chromium in the
# VSCodium Flatpak on arm64 does, although auto picks Docker there).
local use_docker=0
browser_needs_docker "$b" && use_docker=1
if [ "$use_docker" = 1 ] && ! docker_available; then
use_docker=0
elif [ "$use_docker" = 0 ]; then
ensure_native_playwright_browser "$b" >/dev/null 2>&1
native_browser_can_launch "$b" || { docker_available && use_docker=1; }
fi
if [ "$use_docker" = 0 ] && ! native_browser_can_launch "$b"; then
echo "SKIPPED $b: it cannot launch natively here and Docker is unavailable."
results+=("SKIPPED $b"); rc=1; continue
fi
if [ "$use_docker" = 1 ]; then
( cd "$pwdir" && run_playwright_docker "$b" --output="test-results/spec-$b" --reporter=list "${args[@]}" ) 2>&1 | tee "$log"
one=${PIPESTATUS[0]}
else
(
cd "$pwdir"
export HOME="$WEKAN_DIR/.tools"
set_playwright_browser_path
unset CHROME_DEVEL_SANDBOX
export WEKAN_PLAYWRIGHT_ALL=1 WEKAN_PLAYWRIGHT_PROJECT="$b"
PLAYWRIGHT_HTML_OPEN=never meteor npm exec playwright test -- --project="$b" \
--output="test-results/spec-$b" --reporter=list "${args[@]}"
) 2>&1 | tee "$log"
one=${PIPESTATUS[0]}
fi
[ "$one" -eq 0 ] && results+=("PASS $b") || { results+=("FAIL $b (exit $one, $log)"); rc=1; }
done
stop_spec_test_server
echo; echo "===== $spec ====="; printf ' %s\n' "${results[@]}"
return "$rc"
}
# Run the full test matrix (Mocha, import regression, Node E2E and the three
# Playwright browser suites) against ONE WeKan server on http://localhost:3000,
# then print a combined PASS/FAIL summary.
@@ -2909,6 +3088,8 @@ WeKan build.sh - menu, or a command line.
./build.sh --list every command name, with what it does
./build.sh <name> [arguments] run one, without the menu
./build.sh --run-everything every test WeKan and FerretDB have
./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [title filter]
one Playwright spec; starts the test server if needed
Examples:
@@ -2952,6 +3133,9 @@ cli_run() {
# the menu.
case "${1:-}" in
--run-everything) run_everything "${2:-two-worker}"; exit $? ;;
--playwright-spec)
[ -n "${2:-}" ] || { echo "Usage: ./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [title filter]" >&2; exit 2; }
run_playwright_spec "$2" "${3:-chromium}" "${4:-}" build; exit $? ;;
-h|--help|help) cli_help; exit 0 ;;
-l|--list|list) cli_help | head -8; echo; echo "Commands:"; cli_list; exit 0 ;;
"") ;; # no arguments: the menu below
@@ -2995,6 +3179,7 @@ while [ -z "$opt" ]; do
"Playwright Firefox|Test Playwright Firefox" \
"Playwright WebKit|Test Playwright Webkit" \
"Playwright ALL browsers|Test Playwright ALL browsers sequentially (Chromium + Firefox + WebKit, one at a time), server already running on :3000" \
"Playwright single spec|Test one Playwright spec on the browsers you choose; builds and starts the test server when none is running on :3000" \
"Floating-promises guard|Check floating promises guard (@typescript-eslint/no-floating-promises + auth await scan)" \
"Count tests by category|Count amount of tests by category" \
"Run all FerretDB tests - SEQUENTIAL|Run all FerretDB tests - SEQUENTIAL: unit, vet and the integration suite of the FerretDB subdirectory of this repo, one at a time, logs in log/<datetime>/" \
@@ -3383,6 +3568,11 @@ for _once in 1; do
break
;;
"Test one Playwright spec on the browsers you choose; builds and starts the test server when none is running on :3000")
run_playwright_spec
break
;;
"Check floating promises guard (@typescript-eslint/no-floating-promises + auth await scan)")
LOG="$(one_log floating-promises)"
echo "Log: $LOG"
+45 -3
View File
@@ -16,16 +16,58 @@ curl -H "Authorization: Bearer t7iYB86mXoLfP_XsMegxF41oKT7iiA9lDYiKVtXcctl" \
## Result example
```shell
{
[
{
"_id": "AzEeHS7KAGeYZCcak",
"boardId": "YRgy7Ku6uLFv2pYwZ",
"title": "Create Auth Code",
"description": "Create Auth Code for application.",
"listId": "RPRtDTQMKpShpgqoj"
"listId": "RPRtDTQMKpShpgqoj",
"dueAt": "2026-11-30T12:00:00.000Z",
"assignees": ["Ji7nMxZPTcqBDhdNa"],
"sort": 1,
"modifiedAt": "2026-11-19T10:00:00.000Z",
"dateLastActivity": "2026-11-19T10:00:00.000Z",
"labelIds": ["fHTCkZ"],
"members": ["Ji7nMxZPTcqBDhdNa"],
"customFields": [{ "_id": "jN7WWYvD8ywjgcpbM", "value": "Customer A" }]
},
{
...
]
```
Only active (not archived) cards, in their sort order. A field the card does
not have is left out.
# Retrieve cards by list id
| API URL / Code Link | Requires Admin Auth | HTTP Method |
| :--- | :--- | :--- |
| /api/boards/:boardId/lists/:listId/cards | `no` - a board member | `GET` |
```shell
curl -H "Authorization: Bearer t7iYB86mXoLfP_XsMegxF41oKT7iiA9lDYiKVtXcctl" \
-X GET \
http://localhost:3000/api/boards/YRgy7Ku6uLFv2pYwZ/lists/RPRtDTQMKpShpgqoj/cards
```
The same fields as by swimlane, with `swimlaneId` in place of `listId`.
## Fields for syncing
Both card lists carry what a client needs to keep a copy of a board without
a `GET` per card ([#6928](https://github.com/wekan/wekan/issues/6928)):
- `modifiedAt` and `dateLastActivity` - a card whose values did not change
since the last sync can be skipped;
- `labelIds` - the board's label ids, as in `GET /api/boards/:boardId`;
- `members` - user ids;
- `customFields` - `[{ "_id": "<custom field id>", "value": ... }]`. The value
of an **admin-only** custom field is `null` unless the caller is an admin of
the board, exactly as in the single-card `GET`.
Checklists, comments and attachments are still only in the single-card `GET`.
# Add Card to List-Board-Swimlane
| API URL / Code Link | Requires Admin Auth | HTTP Method |
+2
View File
@@ -43,6 +43,8 @@ When calling a production Wekan server, ensure it is running via HTTPS and has a
### Cards
| HTTP Method | Url | Short Description |
| :--- | :--- | :--- |
| `GET` | `/api/boards/:boardId/lists/:listId/cards` | [The active cards of a list, with the fields for syncing.](Cards.md#retrieve-cards-by-list-id) |
| `GET` | `/api/boards/:boardId/swimlanes/:swimlaneId/cards` | [The active cards of a swimlane, with the fields for syncing.](Cards.md#retrieve-cards-by-swimlane-id) |
| `POST` | `/api/boards/:boardId/lists/:listId/cards` | [Add a card to a list, board, and swimlane.](Cards.md#add-card-to-list-board-swimlane) |
| `PUT` | `/api/boards/:boardId/lists/:fromListId/cards/:cardId` | [Update a card.](Cards.md#update-a-card) |
| `DELETE` | `/api/boards/:boardId/lists/:listId/cards/:cardId` | [Delete a card.](Cards.md#update-a-card) |
@@ -10,7 +10,7 @@ This is without container (without Docker or Snap).
Right click and download files 1-4:
1. [wekan-13.19-win64.zip](https://github.com/wekan/wekan/releases/download/v13.19/wekan-13.19-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
1. [wekan-13.20-win64.zip](https://github.com/wekan/wekan/releases/download/v13.20/wekan-13.20-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
2. [node.exe](https://nodejs.org/dist/latest-v26.x/win-x64/node.exe)
@@ -22,7 +22,7 @@ Right click and download files 1-4:
6. Double click `mongodb-windows-x86_64-7.0.34-signed.msi` . In installer, uncheck downloading MongoDB compass.
7. Unzip `wekan-13.19-win64.zip` , inside it is directory `bundle`, to it copy other files:
7. Unzip `wekan-13.20-win64.zip` , inside it is directory `bundle`, to it copy other files:
```
bundle (directory)
@@ -345,6 +345,23 @@ unset CHROME_DEVEL_SANDBOX
## 13) Quick copy-paste: prepare + run Chromium tests
**Just one spec?** `build.sh` does all of the below for you, server included:
```bash
./build.sh --playwright-spec feature-profiles # Chromium
./build.sh --playwright-spec rest-card-list-fields all # all three browsers
./build.sh --playwright-spec feature-profiles chromium "team" # titles containing "team"
```
The same is Tests -> **Playwright single spec** in the `build.sh` and
`build.bat` menus. The spec is a file under `tests/playwright/specs` or a part of
its name. A WeKan already answering on `:3000` is used as it is; otherwise a
fresh bundle is built and the test server started exactly as the whole-suite
runs do (mongod on `:3001`, the bundle on `:3000`), and both are stopped when
the spec is done. In this sandbox Chromium runs natively; Firefox and WebKit
need the Playwright container, so they are skipped when Docker is unavailable.
Logs: `.tools/log/test-playwright-spec/<datetime>/`.
Use this when you want one command block that prepares required paths/dependencies and runs Playwright Chromium tests.
Note: this assumes Wekan app is already running at `http://localhost:3000` in another terminal.
+51
View File
@@ -0,0 +1,51 @@
'use strict';
// One item of the REST card lists - GET /api/boards/:boardId/lists/:listId/cards
// and GET /api/boards/:boardId/swimlanes/:swimlaneId/cards. Both routes build
// their items here, so they cannot drift apart again.
//
// #6928: a client syncing boards had to GET every card on its own to learn its
// labels, members or custom field values, or whether it changed since the last
// sync. These fields are now in the list itself. The single-card GET already
// returns the whole card to the same caller, after the same board access
// check, and admin-only custom field values are concealed by the same
// boundary (sendJsonResult), so nothing here is exposed that was not before.
// They come from the documents the route already read: no extra query.
// A field the card does not have is left out, as JSON leaves out undefined.
// customFields as [{ _id, value }]: the stored entries carry nothing else a
// client needs, and this keeps the answer that shape even if they ever do.
function customFieldValues(customFields) {
if (!Array.isArray(customFields)) return undefined;
return customFields
.filter(field => field && typeof field._id === 'string')
.map(field => ({ _id: field._id, value: field.value === undefined ? null : field.value }));
}
// by: 'list' (the item says its swimlaneId) or 'swimlane' (its listId).
function restCardListItem(doc, by) {
const placement = by === 'swimlane' ? 'listId' : 'swimlaneId';
return {
_id: doc._id,
// Not only for the client: sendJsonResult conceals admin-only custom field
// values (server/apiMiddleware.js), and it scopes each object by its own
// boardId. Without it an admin-only field shared by several boards would
// be hidden from an admin of this one, who may read it.
boardId: doc.boardId,
title: doc.title,
description: doc.description,
[placement]: doc[placement],
receivedAt: doc.receivedAt,
startAt: doc.startAt,
dueAt: doc.dueAt,
endAt: doc.endAt,
assignees: doc.assignees,
sort: doc.sort,
modifiedAt: doc.modifiedAt,
dateLastActivity: doc.dateLastActivity,
labelIds: doc.labelIds,
members: doc.members,
customFields: customFieldValues(doc.customFields),
};
}
module.exports = { restCardListItem, customFieldValues };
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "wekan",
"version": "v13.19.0",
"version": "v13.20.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wekan",
"version": "v13.19.0",
"version": "v13.20.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wekan",
"version": "v13.19.0",
"version": "v13.20.0",
"description": "Open-Source kanban",
"private": true,
"repository": {
+3 -3
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="utf8" />
<title>WeKan REST API v13.19</title>
<title>WeKan REST API v13.20</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@@ -498,11 +498,11 @@ data-styled.g662[id="sc-hFhjrW"]{content:"gelAUe,"}/*!sc*/
<body>
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
<script type="module">
import { hydrate } from "https://cdn.redocly.com/redoc/v3.2.0/bundles/redoc.standalone.js";
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.19","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.20","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
const __redoc_options = {"skipBundle":true,"disableTelemetry":false};
hydrate(__redoc_definition, __redoc_options, document.getElementById('redoc'));
+27 -5
View File
@@ -1,7 +1,7 @@
swagger: '2.0'
info:
title: WeKan REST API
version: v13.19
version: v13.20
description: |
The REST API allows you to control and extend WeKan with ease.
@@ -2916,17 +2916,26 @@ paths:
/api/boards/{board}/lists/{list}/cards:
get:
operationId: get_board_list_cards
summary: Get the active cards of a list
description: |
Each card's swimlaneId, dates, assignees and sort, and also its
modifiedAt, dateLastActivity, labelIds, members and customFields
([{_id, value}]), so a client can sync without a GET per card (#6928).
Admin-only custom field values are null unless the caller is a board admin.
tags:
- Cards
- Cards
parameters:
- name: board
in: path
description: the board value
description: |
the board ID
type: string
required: true
- name: list
in: path
description: the list value
description: |
the list ID
type: string
required: true
produces:
@@ -2937,6 +2946,8 @@ paths:
'200':
description: |-
200 response
schema:
type: [{_id: string, boardId: string, title: string, description: string, swimlaneId: string, receivedAt: string, startAt: string, dueAt: string, endAt: string, assignees: [string], sort: number, modifiedAt: string, dateLastActivity: string, labelIds: [string], members: [string], customFields: [{_id: string, value: string}]}]
post:
operationId: post_board_list_cards
tags:
@@ -4102,17 +4113,26 @@ paths:
/api/boards/{board}/swimlanes/{swimlane}/cards:
get:
operationId: get_board_swimlane_cards
summary: Get the active cards of a swimlane
description: |
Each card's listId, dates, assignees and sort, and also its
modifiedAt, dateLastActivity, labelIds, members and customFields
([{_id, value}]), so a client can sync without a GET per card (#6928).
Admin-only custom field values are null unless the caller is a board admin.
tags:
- Cards
- Cards
parameters:
- name: board
in: path
description: the board value
description: |
the board ID
type: string
required: true
- name: swimlane
in: path
description: the swimlane value
description: |
the swimlane ID
type: string
required: true
produces:
@@ -4123,6 +4143,8 @@ paths:
'200':
description: |-
200 response
schema:
type: [{_id: string, boardId: string, title: string, description: string, listId: string, receivedAt: string, startAt: string, dueAt: string, endAt: string, assignees: [string], sort: number, modifiedAt: string, dateLastActivity: string, labelIds: [string], members: [string], customFields: [{_id: string, value: string}]}]
/api/boards/{board}/swimlanes/{swimlane}/copy:
post:
operationId: post_board_swimlane_copy
+2 -2
View File
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
appTitle = (defaultText = "Wekan"),
# The name of the app as it is displayed to the user.
appVersion = 1319,
appVersion = 1320,
# Increment this for every release.
appMarketingVersion = (defaultText = "13.19~2026-11-19"),
appMarketingVersion = (defaultText = "13.20~2026-11-19"),
# Human-readable presentation of the app version.
minUpgradableAppVersion = 0,
+33 -24
View File
@@ -2,6 +2,7 @@ import { cardWithChecklists } from '/server/lib/checklistDeadlines';
import { canWriteSubtaskDeposit, recordSubtaskDepositDenial } from '/server/lib/subtaskDepositAccess';
import { recordLinkedWriteDenial } from '/models/lib/linkedWritePolicy';
const { isAssignedOnlyMember } = require('/models/lib/boardCardScope');
const { restCardListItem } = require('/models/lib/restCardListItem');
import { Meteor } from 'meteor/meteor';
import { WebApp } from 'meteor/webapp';
import { check, Match } from 'meteor/check';
@@ -1427,6 +1428,21 @@ Cards.after.remove(async (userId, doc) => {
});
});
/**
* @operation get_board_swimlane_cards
* @tag Cards
*
* @summary Get the active cards of a swimlane
*
* @description Each card's listId, dates, assignees and sort, and also its
* modifiedAt, dateLastActivity, labelIds, members and customFields
* ([{_id, value}]), so a client can sync without a GET per card (#6928).
* Admin-only custom field values are null unless the caller is a board admin.
*
* @param {string} boardId the board ID
* @param {string} swimlaneId the swimlane ID
* @return_type [{_id: string, boardId: string, title: string, description: string, listId: string, receivedAt: string, startAt: string, dueAt: string, endAt: string, assignees: [string], sort: number, modifiedAt: string, dateLastActivity: string, labelIds: [string], members: [string], customFields: [{_id: string, value: string}]}]
*/
WebApp.handlers.get(
'/api/boards/:boardId/swimlanes/:swimlaneId/cards',
async function(req, res) {
@@ -1443,22 +1459,26 @@ WebApp.handlers.get(
);
sendJsonResult(res, {
code: 200,
data: cards.map(doc => ({
_id: doc._id,
title: doc.title,
description: doc.description,
listId: doc.listId,
receivedAt: doc.receivedAt,
startAt: doc.startAt,
dueAt: doc.dueAt,
endAt: doc.endAt,
assignees: doc.assignees,
sort: doc.sort,
})),
data: cards.map(doc => restCardListItem(doc, 'swimlane')),
});
},
);
/**
* @operation get_board_list_cards
* @tag Cards
*
* @summary Get the active cards of a list
*
* @description Each card's swimlaneId, dates, assignees and sort, and also its
* modifiedAt, dateLastActivity, labelIds, members and customFields
* ([{_id, value}]), so a client can sync without a GET per card (#6928).
* Admin-only custom field values are null unless the caller is a board admin.
*
* @param {string} boardId the board ID
* @param {string} listId the list ID
* @return_type [{_id: string, boardId: string, title: string, description: string, swimlaneId: string, receivedAt: string, startAt: string, dueAt: string, endAt: string, assignees: [string], sort: number, modifiedAt: string, dateLastActivity: string, labelIds: [string], members: [string], customFields: [{_id: string, value: string}]}]
*/
WebApp.handlers.get('/api/boards/:boardId/lists/:listId/cards', async function(req, res) {
const paramBoardId = req.params.boardId;
const paramListId = req.params.listId;
@@ -1473,18 +1493,7 @@ WebApp.handlers.get('/api/boards/:boardId/lists/:listId/cards', async function(r
);
sendJsonResult(res, {
code: 200,
data: cards.map(doc => ({
_id: doc._id,
title: doc.title,
description: doc.description,
swimlaneId: doc.swimlaneId,
receivedAt: doc.receivedAt,
startAt: doc.startAt,
dueAt: doc.dueAt,
endAt: doc.endAt,
assignees: doc.assignees,
sort: doc.sort,
})),
data: cards.map(doc => restCardListItem(doc, 'list')),
});
});
+4 -4
View File
@@ -19,7 +19,7 @@
# base: core24 (not core26) · no build-base: devel · grade: stable
# ─────────────────────────────────────────────────────────────────────────────
name: wekan
version: '13.19'
version: '13.20'
base: core24
confinement: strict
grade: stable
@@ -703,18 +703,18 @@ parts:
armhf) WEKAN_ARCH="armhf" ;;
*) echo "Unsupported architecture: ${CRAFT_ARCH_BUILD_FOR}"; exit 1 ;;
esac
WEKAN_ZIP="wekan-13.19-${WEKAN_ARCH}.zip"
WEKAN_ZIP="wekan-13.20-${WEKAN_ARCH}.zip"
echo "Cleaning environment first"
rm -rf .build
mkdir .build
cd .build
#wget https://github.com/wekan/wekan/releases/download/v13.19/wekan-13.19-amd64.zip
#wget https://github.com/wekan/wekan/releases/download/v13.20/wekan-13.20-amd64.zip
# Retry: a release asset can 404 for a short while right after it is
# uploaded (CDN/propagation lag), and a plain wget treated that as
# fatal. --retry-on-http-error covers the 404/5xx window; a genuinely
# missing bundle still fails after the tries are spent.
wget --tries=20 --waitretry=20 --retry-on-http-error=404,403,500,502,503 \
"https://github.com/wekan/wekan/releases/download/v13.19/${WEKAN_ZIP}"
"https://github.com/wekan/wekan/releases/download/v13.20/${WEKAN_ZIP}"
unzip "${WEKAN_ZIP}"
python3 ../releases/check-telemetry.py --bundle bundle
rm "${WEKAN_ZIP}"
+6 -1
View File
@@ -751,7 +751,12 @@ test('a test run stops the databases it started, on every way out', () => {
// cmd has no trap, so the .bat does the same clearing on the way IN.
assert.ok(/^:stop_test_databases$/m.test(bat), 'build.bat has the same label');
const calls = (bat.match(/call :stop_test_databases/g) || []).length;
// "Playwright single spec" (:test_pw_spec) is not an all-tests flow: it
// REUSES a server that already answers, so it must not clear one first, and
// it stops only what it started (tests/playwrightSingleSpec.test.cjs).
const spec = bat.slice(bat.indexOf('\n:test_pw_spec\n'), bat.indexOf('\n:test_pw_parallel'));
assert.ok(spec.length > 100, 'the single-spec block is found');
const calls = (bat.replace(spec, '').match(/call :stop_test_databases/g) || []).length;
assert.strictEqual(calls, 4,
'called at the start AND the end of both all-tests flows: starting from a '
+ 'clean slate is the batch answer to a trap it cannot have');
@@ -0,0 +1,49 @@
'use strict';
// #6928: the REST card lists of a list and of a swimlane carry modifiedAt,
// dateLastActivity, labelIds, members and customFields, so a syncing client
// needs no GET per card - and an admin-only custom field's value stays
// concealed from a member who is not a board admin, as on the single-card GET.
const { test, expect } = require('../fixtures');
const db = require('../helpers/db');
const auth = token => ({ headers: { Authorization: `Bearer ${token}` } });
test('list and swimlane card lists carry the sync fields; admin-only values stay concealed', async ({ request, user, user2 }) => {
const board = db.seedBoard({ ownerId: user.id, listCount: 1, cardTitlesPerList: [['Synced card']] });
try {
db.addBoardMember({ boardId: board.boardId, userId: user2.id });
const card = db.findOne('cards', { boardId: board.boardId });
const secret = db.uid('secret'), open = db.uid('open');
for (const [id, adminOnly] of [[secret, true], [open, false]]) db.insertOne('customFields', {
_id: id, boardIds: [board.boardId], name: adminOnly ? 'Secret budget' : 'Public note', type: 'text', settings: {}, adminOnly,
});
const at = new Date('2026-11-19T10:00:00Z');
db.updateOne('cards', { _id: card._id }, { $set: {
labelIds: ['e2eLabel'], members: [user.id], modifiedAt: at, dateLastActivity: at,
customFields: [{ _id: secret, value: 'CLASSIFIED-6928' }, { _id: open, value: 'VISIBLE' }],
} });
const urls = [`/api/boards/${board.boardId}/lists/${board.listIds[0]}/cards`,
`/api/boards/${board.boardId}/swimlanes/${board.swimlaneId}/cards`];
for (const url of urls) {
const res = await request.get(url, auth(user.token));
expect(res.status(), url).toBe(200);
const [item] = (await res.json()).filter(c => c._id === card._id);
expect(item.labelIds).toEqual(['e2eLabel']);
expect(item.members).toEqual([user.id]);
expect(new Date(item.modifiedAt).toISOString()).toBe(at.toISOString());
expect(new Date(item.dateLastActivity).toISOString()).toBe(at.toISOString());
// The board admin reads both values.
expect(item.customFields).toEqual([{ _id: secret, value: 'CLASSIFIED-6928' }, { _id: open, value: 'VISIBLE' }]);
// Negative: a member who is not a board admin gets the admin-only one as null.
const member = await request.get(url, auth(user2.token));
expect(member.status(), url).toBe(200);
const text = await member.text();
expect(text).not.toContain('CLASSIFIED-6928');
const [seen] = JSON.parse(text).filter(c => c._id === card._id);
expect(seen.customFields).toEqual([{ _id: secret, value: null }, { _id: open, value: 'VISIBLE' }]);
}
} finally {
db.deleteMany('customFields', { boardIds: board.boardId });
db.cleanup({ boardIds: [board.boardId] });
}
});
+88
View File
@@ -0,0 +1,88 @@
'use strict';
// build.sh and build.bat: Tests -> "Playwright single spec", and
// ./build.sh --playwright-spec <spec> [browser] [title filter]. One spec, on the
// browsers chosen, against a server that already runs or one built and started
// for it - the same server the whole-suite runs start, so a single spec does not
// pass on a stale bundle.
// Run: node --test tests/playwrightSingleSpec.test.cjs
const test = require('node:test');
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const { spawnSync } = require('node:child_process');
const root = path.resolve(__dirname, '..');
const sh = fs.readFileSync(path.join(root, 'build.sh'), 'utf8');
const bat = fs.readFileSync(path.join(root, 'build.bat'), 'utf8');
const fn = name => {
const start = sh.indexOf(`function ${name}(){`);
assert.ok(start >= 0, name);
return sh.slice(start, sh.indexOf('\n}\n', start) + 3);
};
// The matcher, run as bash runs it.
function match(want) {
// The name goes in through the environment, not into the script text.
const r = spawnSync('bash', ['-c', `${fn('playwright_specs_matching')}\nplaywright_specs_matching "$WANT"`],
{ encoding: 'utf8', env: { ...process.env, WEKAN_DIR: root, WANT: want } });
return r.stdout.trim().split('\n').filter(Boolean);
}
test('a spec is found by its file, its path, or a part of its name', () => {
for (const want of ['rest-card-list-fields.e2e.js', 'specs/rest-card-list-fields.e2e.js',
'tests/playwright/specs/rest-card-list-fields.e2e.js', 'rest-card-list-fields']) {
assert.deepStrictEqual(match(want), ['specs/rest-card-list-fields.e2e.js'], want);
}
assert.ok(match('card').length > 1, 'a part of several names lists them all');
// Negative: no match is nothing, not every spec.
assert.deepStrictEqual(match('no-such-spec-xyz'), []);
});
test('negative: the command line refuses before building anything', () => {
const run = (...args) => spawnSync('bash', [path.join(root, 'build.sh'), '--playwright-spec', ...args],
{ cwd: root, encoding: 'utf8', input: '', timeout: 60000 });
const cases = [
[[], /Usage: \.\/build\.sh --playwright-spec/],
[['no-such-spec-xyz'], /no spec under tests\/playwright\/specs matches/],
[['card', 'chromium'], /matches several specs - name one/],
[['rest-card-list-fields', 'opera'], /browser must be chromium, firefox, webkit or all/],
];
for (const [args, message] of cases) {
const r = run(...args);
assert.notStrictEqual(r.status, 0, args.join(' '));
assert.match(r.stdout + r.stderr, message, args.join(' '));
assert.doesNotMatch(r.stdout + r.stderr, /Building WeKan/, `${args.join(' ')} must not build`);
}
});
test('build.sh: the menu entry, its case arm and the server it starts', () => {
const desc = 'Test one Playwright spec on the browsers you choose; builds and starts the test server when none is running on :3000';
assert.ok(sh.includes(`"Playwright single spec|${desc}"`), 'menu entry');
assert.ok(sh.includes(` "${desc}")\n\t\t\trun_playwright_spec\n`), 'case arm with the same description');
const server = fn('start_spec_test_server');
// A server that answers is reused; otherwise the current source is built first.
assert.ok(server.indexOf('curl -fsS') < server.indexOf('build_wekan'));
for (const needle of ['MONGO_URL="$WEKAN_MONGO_URL"', 'ROOT_URL="http://localhost:3000"', 'WITH_API=true',
'WRITABLE_PATH="$writable"', 'mongo_answers "$port"', '/meteor"']) {
assert.ok(server.includes(needle), needle);
}
const runner = fn('run_playwright_spec');
assert.match(runner, /start_spec_test_server[\s\S]*stop_spec_test_server/, 'what it starts, it stops');
assert.match(runner, /run_playwright_docker "\$b"[\s\S]*"\$\{args\[@\]\}"/, 'the spec reaches the container too');
assert.match(runner, /--project="\$b"[\s\S]*"\$\{args\[@\]\}"/);
// Only what this run started is stopped.
assert.match(fn('stop_spec_test_server'), /SPEC_SERVER_PID[\s\S]*SPEC_MONGOD_PID/);
});
test('build.bat: the same option, with the same server steps', () => {
assert.match(bat, /echo 19\^\) Playwright single spec/);
assert.match(bat, /if "%choice%"=="19" goto test_pw_spec/);
const body = bat.slice(bat.indexOf(':test_pw_spec\n'), bat.indexOf('\n:test_pw_parallel'));
assert.ok(body.length > 100);
for (const step of ['call :rebuild_for_tests', 'call :start_bundle_server', 'call :stop_test_databases',
'curl -fsS http://127.0.0.1:3000/sign-in', 'call :logdir test-playwright-spec', '"specs/%PW_MATCH%"']) {
assert.ok(body.includes(step), step);
}
// Stops the server only when this option started it.
assert.match(body, /if "%PW_STARTED%"=="1" call :stop_test_databases/);
});
+89
View File
@@ -0,0 +1,89 @@
'use strict';
// #6928: the REST card lists of a list and of a swimlane carry modifiedAt,
// dateLastActivity, labelIds, members and customFields, so a syncing client
// does not need a GET per card - and an admin-only custom field's value is
// still concealed from a member who is not a board admin.
// Run: node --test tests/restCardListFields.test.cjs
const test = require('node:test');
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const { restCardListItem, customFieldValues } = require('../models/lib/restCardListItem');
const { redact, containsFields } = require('../models/lib/adminOnlyCustomFields');
const read = rel => fs.readFileSync(path.join(__dirname, '..', rel), 'utf8');
const modifiedAt = new Date('2026-11-19T10:00:00Z');
const dateLastActivity = new Date('2026-11-19T11:00:00Z');
const card = {
_id: 'c1', boardId: 'b1', listId: 'l1', swimlaneId: 's1', title: 'T', description: 'D',
sort: 2, assignees: ['u2'], modifiedAt, dateLastActivity,
labelIds: ['lab1'], members: ['u1', 'u2'],
customFields: [{ _id: 'secret', value: 'CLASSIFIED' }, { _id: 'open', value: 'VISIBLE' }],
// Things a list item never carried and still does not.
userId: 'u1', archived: false, vote: { positive: ['u3'] }, integrityHash: 'h',
};
test('a list item carries the sync fields, and its placement the URL did not fix', () => {
const item = restCardListItem(card, 'list');
assert.deepStrictEqual(Object.keys(item), ['_id', 'boardId', 'title', 'description', 'swimlaneId',
'receivedAt', 'startAt', 'dueAt', 'endAt', 'assignees', 'sort',
'modifiedAt', 'dateLastActivity', 'labelIds', 'members', 'customFields']);
assert.strictEqual(item.modifiedAt, modifiedAt);
assert.strictEqual(item.dateLastActivity, dateLastActivity);
assert.deepStrictEqual(item.labelIds, ['lab1']);
assert.deepStrictEqual(item.members, ['u1', 'u2']);
assert.deepStrictEqual(item.customFields, card.customFields);
const bySwimlane = restCardListItem(card, 'swimlane');
assert.strictEqual(bySwimlane.listId, 'l1');
assert.ok(!('swimlaneId' in bySwimlane));
// The same fields either way, so the two routes stay alike.
assert.deepStrictEqual(Object.keys(bySwimlane).filter(k => k !== 'listId'),
Object.keys(item).filter(k => k !== 'swimlaneId'));
});
test('negative: nothing else of the card document is added', () => {
const json = JSON.stringify([restCardListItem(card, 'list')]);
for (const key of ['userId', 'archived', 'vote', 'integrityHash']) assert.ok(!json.includes(`"${key}"`), key);
assert.deepStrictEqual(customFieldValues([{ _id: 'f', value: 1, extra: 'x' }, { _id: 'g' }, null, { value: 2 }]),
[{ _id: 'f', value: 1 }, { _id: 'g', value: null }]);
assert.strictEqual(customFieldValues(undefined), undefined);
// A card without them stays as before: the fields are absent from the JSON.
const bare = JSON.parse(JSON.stringify(restCardListItem({ _id: 'c2', boardId: 'b1', title: 'x' }, 'list')));
assert.deepStrictEqual(Object.keys(bare), ['_id', 'boardId', 'title']);
});
test('an admin-only value is concealed from a member, shown to a board admin', () => {
const definitions = new Map([
// Shared by two boards: scoped by the item's own boardId, the admin of b1 reads it.
['secret', { _id: 'secret', adminOnly: true, boardIds: ['b1', 'b2'] }],
['open', { _id: 'open', adminOnly: false, boardIds: ['b1'] }],
]);
const data = [restCardListItem(card, 'list'), restCardListItem(card, 'swimlane')];
assert.ok(containsFields(data), 'sendJsonResult sends it through the redaction');
for (const item of redact(data, definitions, new Set(), undefined)) {
assert.deepStrictEqual(item.customFields, [{ _id: 'secret', value: null }, { _id: 'open', value: 'VISIBLE' }]);
}
for (const item of redact(data, definitions, new Set(['b1']), undefined)) {
assert.deepStrictEqual(item.customFields, card.customFields);
}
// Negative: without its boardId the shared field would be judged by both of
// its boards, and this board's admin would lose a value they may read.
const { boardId, ...unscoped } = data[0];
assert.strictEqual(redact([unscoped], definitions, new Set(['b1']), undefined)[0].customFields[0].value, null);
});
test('both routes build their items here and answer through sendJsonResult', () => {
const src = read('server/models/cards.js');
for (const [route, by] of [['/api/boards/:boardId/lists/:listId/cards', 'list'],
['/api/boards/:boardId/swimlanes/:swimlaneId/cards', 'swimlane']]) {
const start = src.indexOf(`'${route}'`);
assert.ok(start > 0, route);
const body = src.slice(start, src.indexOf('\n});', start));
assert.match(body, /await Authentication\.checkBoardAccess\(req\.userId, paramBoardId\);/, route);
assert.match(body, /archived: false/, route);
assert.ok(body.includes(`cards.map(doc => restCardListItem(doc, '${by}'))`), route);
// The redaction boundary: no route writes the JSON around it.
assert.match(body, /sendJsonResult\(res, \{/, route);
assert.doesNotMatch(body, /writeJsonResult|res\.end\(/, route);
}
});