The Story and Task commit (0d77882c3b) declared cardKinds as
`type: [String]`, which the schema library rejects at startup ("Invalid
definition for cardKinds field: type may not be an array"), so WeKan
stopped. It is `type: Array` with a 'cardKinds.$' entry of the two kinds
now. Found by a Meteor runtime test run; tests/cardKinds.test.cjs now
pins the form and checks that no array shorthand type is left in the
schemas these changes touched.
Thanks to xet7 !
A card can be a Story or a Task: card menu / Card kind (or an ordinary
card again), with a book or a checked-box badge on the minicard. A custom
field can be limited to card kinds - "Only on these card kinds", none
ticked being every card as before. A kind's own fields are added to a
card when it gets that kind, and shown only on cards of it; a field of
no kind shows on every card. The one choke point every render uses,
customFieldsWD, leaves out fields of other kinds, so the card details and
minicard agree.
models/lib/cardKinds.js decides; tests/cardKinds.test.cjs covers the
fields a kind brings, not twice, other kinds' fields staying off, unknown
kinds, and the card menu, badge and the field's ticks. The new strings
are English placeholders until the next translation pass.
Thanks to nightwind27 and xet7 !
Fixes#2012.
A custom field could be hidden from non-admins (adminOnly, #3141), but not
shown to everyone while editable only by admins, which a score or a value
computed elsewhere needs. A custom field can now be marked read-only in its
settings: every board member sees the value, and only a board admin - or the
REST API and rules acting as one - can set, change or clear it. The card
editor offers editing only to board admins, and the server refuses everyone
else through adminOnly's write guard, at the driver boundary, so no write
path is left out. Turning the flag on or off is itself an admin's change.
tests/readOnlyCustomField.test.cjs drives the rule, including setting an
empty field and clearing one. New text is in English, pending Transifex.
Thanks to CarloRampini and xet7 !
Fixes#3143.
Add field ID and unit controls to Jira import, validate before writes, and preserve mapping through Jira/native exports and board copies. Keep new fields hidden and reuse existing labels and permissions.
Thanks to xet7 !
Mark imported numeric estimate fields independently of their names, convert hours back to seconds, and honor Dates and Custom Fields export selections. Verify renaming, omissions, invalid and ambiguous values, and actual Jira re-import.
Thanks to xet7 !
The user's own ./build.sh run reproduced it directly: "[uncaughtException]
WeKan is stopping: Error: Invalid definition for sort field: 'decimal' is
not a supported property", thrown from SimpleSchema's own constructor the
moment the server started - before any board could load. `decimal: true`
is not, and has never been, a property SimpleSchema recognizes (its
schemaDefinitionOptions list is autoValue/defaultValue/label/optional/
required/type, plus WeKan's own extendOptions(['index', 'unique']) in
imports/simpleSchema.js); nothing exercises that validation under a plain
Node test, which is why it slipped through review. `type: Number` already
allows fractional values with no extra flag - the same as Lists' own
`sort` field, which this one was deliberately written to mirror (see the
field's own comment) and which never had this property either - so
removing it changes nothing about what the field accepts.
tests/customFieldsSortSchema.test.cjs pins the sort field's definition
against SimpleSchema's actual valid-property list and sweeps every other
file under models/ for the same shape, so it cannot reappear anywhere else
undetected by a Node-only test run.
Verified against a real Meteor boot (`meteor run`) in-sandbox: reproduced
the crash before this commit, starts cleanly after.
Thanks to xet7 !
A custom field marked Admin only has its value hidden from - and cannot be
set by - a non board-admin board member: not on the card detail view, not on
the minicard, not in the card's "assign a custom field" popup list, and not
through the setCardCustomFieldCheckbox/setCardCustomFieldCurrency Meteor
methods or a direct client write of customFields.<index>.value. The toggle
itself, in the custom-field definition editor, is only rendered for and only
writable by a board admin (CustomFields.allow's update/insert rules now check
board.hasAdmin() specifically for the adminOnly field, on top of the existing
write-access check every other field edit already requires).
models/lib/customFieldsWD.js gets a small pure filterAdminOnlyDefinitions()
helper so the gate has one tested choke point: models/cards.js's
customFieldsWD() - shared by both the card-detail and minicard templates -
filters admin-only definitions out before matching them to a value, and
client/components/cards/cardCustomFields.js reuses the same helper for the
popup's field list.
Thanks to CarloRampini and xet7 !
Closes#3141,
Custom fields rendered alphabetically by name everywhere - the board
settings sidebar list and every card - with no way to change it, so users
worked around it by prefixing names with numbers (#4165).
Add a numeric `sort` field to the CustomFields schema (optional, so fields
created before this exist keep sorting by name as a fallback). The board
settings sidebar list (client/components/sidebar/sidebarCustomFields.jade/js)
gets a drag handle and jQuery-ui sortable, mirroring the card-labels popup's
own reordering (client/components/cards/labels.js) - the smallest existing
pattern for a short settings list that rewrites its whole order on drop.
Dropping recomputes sequential `sort` values with computeSortIndexMapping(),
the same pure helper the All Boards page already uses for its own
drag-reorder (models/lib/boardSortReorder.js), so no new reordering logic
was added. A newly created field defaults to the end of the board's current
list (the count of existing fields), not the top.
models/lib/customFieldsWD.js - the shared matcher that builds a card's
custom-field list from its board's definitions - now sorts by `sort`
ascending instead of by name, falling back to name for fields with no
`sort` yet. This is the one place both the card detail view and the
card's custom-fields popup get their order from, so no other rendering
path needed changes.
Thanks to huma2000 and xet7 !
Closes#4165,