Commit Graph
64 Commits
Author SHA1 Message Date
Lauri Ojansivu d3966fa6b9 Fix the custom field cardKinds schema: WeKan stopped at startup.
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 !
2026-10-14 15:41:26 +03:00
Lauri Ojansivu 0d77882c3b Story and Task cards, with custom fields of their own.
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.
2026-10-14 15:26:00 +03:00
Lauri Ojansivu 87ae8895c3 Add read-only custom fields that every member sees and only admins set.
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.
2026-10-08 12:05:59 +03:00
Lauri Ojansivu a76c97461d Map explicit Jira numeric estimates to existing Scrum custom fields
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 !
2026-09-27 20:53:56 +03:00
Lauri Ojansivu c72b9a4a06 Round-trip Jira time tracking through external export
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 !
2026-09-27 19:08:35 +03:00
Lauri Ojansivu 7930da455a Fix a boot-crashing invalid SimpleSchema property on customFields.sort.
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 !
2026-09-10 23:43:06 +03:00
Lauri Ojansivu 76dcb6575a Add an "Admin only" flag on custom field definitions (#3141).
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,
2026-09-10 20:34:30 +03:00
Lauri Ojansivu 0c6901f3a9 Add a user-settable display order for custom fields, via drag-and-drop.
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,
2026-09-10 19:49:28 +03:00
Harry Adel 63ce45c538 Split shared models from Meteor 3 server runtime 2026-03-24 01:50:39 +02:00
Harry Adel 2e3fbf25db Meteor 3.4 migration: Convert allow/deny callbacks to async
Meteor 3.x supports async allow/deny callbacks. Convert all 25 sync
allow/deny callbacks across 23 model files to use async/await with
findOneAsync/fetchAsync instead of sync findOne/find().fetch().

Also converts helper functions in server/lib/utils.js:
- allowIsBoardMemberWithWriteAccessByCard -> async
- allowIsBoardMemberByCard -> async
- canUpdateCard (cards.js) -> async
- permissionHelper.allow (integrations.js) -> async
2026-03-22 17:44:29 +02:00
Harry Adel b5782c7b86 Replace underscore with native JS in models
Largest changes in cards.js (~76 calls), boards.js (~38 calls),
and activities.js (~31 calls). Key patterns:

- _.contains -> .includes() with null guards where needed
- _.findWhere/_.where -> findWhere()/where() helpers
- _.pluck -> .map()
- _.union -> [...new Set()]
- _.extend -> Object.assign()
- _.each on objects -> Object.entries().forEach() (argument order swap)
- _.debounce -> debounce() helper
- _.groupBy/_.indexBy -> groupBy()/indexBy() helpers
- _.clone -> spread operator
- _.sortBy -> [...arr].sort()
- Type checks -> native typeof
2026-03-18 22:39:06 +02:00
Lauri Ojansivu 73eb98c57a Fix GHSL-2026-044_Wekan.
Thanks to GHSL and xet7.
2026-02-19 23:40:56 +02:00
Harry Adel e77be37450 Use sync code in allow/deny for 2.x 2026-02-19 00:26:47 +02:00
Harry Adel 71eb01e233 Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async

Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
  checklists, checklistItems, customFields, attachments, integrations,
  cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
Lauri Ojansivu 25eedd187e Merge pull request #6093 from harryadel/createIndex-migration
Migrate createIndex to createIndexAsync
2026-01-24 02:04:35 +02:00
Harry Adel ca2083c858 Migrate createIndex to createIndexAsync 2026-01-24 01:55:29 +02:00
Harry Adel 94a3575e2c Replace mquandalle:collection-mutations with collection helpers 2026-01-21 19:22:54 +02:00
Jakub Jurczyk 7865368153 Fix return value of edit_custom_field_dropdown_item 2023-08-02 14:11:47 +02:00
Martin Filser f83ee124d0 Move every Boards.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/) 2023-07-18 21:25:29 +02:00
Martin Filser 981a641bce Move every CustomFields.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/) 2023-07-18 21:25:28 +02:00
Martin Filser 08e3ca3435 Move every Activities.findOne(idOrFirstObjectSelector, options) to the ReactiveCache 2023-07-18 21:25:28 +02:00
Martin Filser 806ad78637 Move every CustomFields.findOne(idOrFirstObjectSelector, options) to the ReactiveCache 2023-07-18 21:25:28 +02:00
Martin Filser 3b65113d05 Move every Cards.findOne() to the ReactiveCache 2023-07-18 21:25:28 +02:00
Martin Filser a182482cfb Move every Boards.findOne(boardId) to the ReactiveCache (Part 2) 2023-07-18 21:25:28 +02:00
Lauri Ojansivu 8092f8be28 Try to fix User API.
Thanks to xet7 !

Fixes #4039
2023-01-13 21:50:39 +02:00
Lauri Ojansivu c926475eb1 Fixed _ensureIndex to createIndex for MongoDB 5. Updated to latest Meteor beta. 2022-04-18 18:08:12 +03:00
Lauri Ojansivu e3a0dea85f Fixed REST API, it shoud work now by Admin user.
Reverted Allow board members to use more of API of Wekan v5.35
https://github.com/wekan/wekan/commit/a719e8fda1f78bcbf9af6e7b4341f8be1d141e90

Thanks to tomhughes.

Fixes #4009,
fixes #2793,
fixes #2790
2021-09-25 18:09:18 +03:00
Lauri Ojansivu 8626b466b8 Sum of cards. In Progress.
Thanks to xet7 !

Related #3796
2021-09-08 15:55:53 +03:00
Lauri Ojansivu 164b6e9070 Part 2: Allow board members to use more of API. Please add issue (or pull request) if this allows too much.
Thanks to JayVii and xet7 !

Fixes #3862
2021-06-14 15:13:15 +03:00
Lauri Ojansivu a719e8fda1 Allow board members to use more of API. Please add issue (or pull request) if this allows too much.
Thanks to JayVii and xet7 !

Fixes #3862
2021-06-14 15:01:37 +03:00
tod31 3778a9ebcf add configuration field for separator 2021-04-09 11:46:07 +02:00
tod31 b8dc7ff18e add custom field "stringtemplate" 2021-04-09 11:44:49 +02:00
Lauri Ojansivu 0bb3b67075 Fixed generating API docs and Wekan Custom Fields REST API.
Thanks to xet7 !
2021-03-07 17:57:24 +02:00
Louis Orleans 9cbef4ba4b 🔒 fix warning from deepcode 2021-02-20 14:11:17 -08:00
Louis Orleans 24035329b8 ✨ edit custom field dropdown item 2021-02-20 13:50:24 -08:00
Louis Orleans 457977f954 ✨ add and remove dropdown items 2021-02-20 12:46:29 -08:00
Louis Orleans 373dc5cadb ⏪ Revert "🎨 format with Prettier"
This reverts commit a35cfe660e.
2021-02-20 09:27:33 -08:00
Louis Orleans a35cfe660e 🎨 format with Prettier 2021-02-20 09:02:36 -08:00
Louis Orleans db666eec65 🐛 fix updating fields 2021-02-20 09:02:12 -08:00
Louis Orleans 586473aaa7 ✨ add custom field edit REST API 2021-02-19 11:21:13 -08:00
John R. Supplee 0adde3e06d Fix Wekan JSON import bug
If not all users are mapped the import crashes.
2021-01-28 00:44:48 +02:00
John R. Supplee 74d93a6adc Option to add custom field to all cards 2021-01-22 21:28:37 +02:00
John R. Supplee c89a0eb694 Initial work on import of custom fields from Trello
* start adding import functionality
* Add checkbox type to customFields
2021-01-18 16:41:35 +02:00
Lauri Ojansivu 3b2b108744 Fix: Unable to delete a custom field in a board.
Thanks to xet7 !

Fixes #2605
2020-06-16 19:55:56 +03:00
Haben Amare 8732e4b18f use Intl.NumberFormat to format currency 2020-05-25 22:05:06 +00:00
Haben Amare 3cf6ed916f add the 'currency' custom field type 2020-05-25 22:02:51 +00:00
Justin Reynolds 3b9f2ca7c2 Fixes #2596 incorrect date types for created & updated 2019-09-05 12:29:45 -05:00
James Byrne 851246a59b Updated insert action for CustomFields API 2019-08-12 17:47:04 +01:00
Lauri Ojansivu 2003d90467 Outgoing Webhooks setCustomField: Add board name, card name, custom field name to be visible.
Still missing: custom field value, list name, swimlane name.

Thanks to xet7 !
2019-07-10 17:46:07 -04:00
Justin Reynolds 3eb4d2c341 Prettier & eslint project style update 2019-06-28 12:56:51 -05:00