Commit c016227
authored
## Summary
`CategoryForm` declared `private boolean active;` (a Java primitive that
defaults to `false`). Because `CategoriesResource.fillAndSave()` runs
`BeanUtils.copyProperties(category, categoryForm)` on POST, an omitted
`active` field on the request silently overwrote the `Category` model's
`true` default — every category created from the new Angular categories
portlet (which doesn't send `active`) was created inactive.
Defaulting both the form field and the inner `Builder` field to `true`
makes omitted JSON behave like the model: omitted ⇒ active, explicit
`true`/`false` ⇒ honored.
<img width="1602" height="874" alt="CleanShot 2026-04-29 at 16 08 38@2x"
src="https://github.com/user-attachments/assets/c116526b-6cf8-4198-b86a-38000402ca50"
/>
Closes #35501
## Acceptance Criteria
- [x] **AC1** — POST without `active` ⇒ category active (verified by
`deserialize_omittedActive_defaultsToTrue`)
- [x] **AC2** — POST with `"active": false` ⇒ category inactive
(verified by `deserialize_explicitActiveFalse_isPreserved`)
- [x] **AC3** — POST with `"active": true` ⇒ category active (verified
by `deserialize_explicitActiveTrue_isPreserved`)
- [x] **AC4/AC5** — PUT semantics unchanged: `fillAndSave` (PUT
overload) seeds the update from the existing entity and only re-applies
`categoryName`, `key`, `keywords` from the form, so the form's `active`
was never read on PUT before this fix and is still not read after —
existing values are preserved when omitted.
- [x] **AC6** — New Angular categories portlet creates active categories
by default (it omits `active`, which now defaults to `true` server-side)
- [x] **AC7** — No retroactive change: only the default for new POSTs
changes; existing rows are untouched.
- [x] **AC8** — Unit test added: `CategoryFormTest` covers all three
create scenarios + Builder default.
## Test plan
- [x] `./mvnw test -pl :dotcms-core -Dtest=CategoryFormTest` — 4/4
passing locally
- [ ] Manual: create a category through the new Angular categories
portlet and verify it appears as active
- [ ] CI: full test suite
## Changed files
-
`dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryForm.java`
— default `active = true` on class field and Builder field
-
`dotCMS/src/test/java/com/dotcms/rest/api/v1/categories/CategoryFormTest.java`
— new unit test
1 parent 58cb228 commit c016227
2 files changed
Lines changed: 69 additions & 1 deletion
File tree
- dotCMS/src
- main/java/com/dotcms/rest/api/v1/categories
- test/java/com/dotcms/rest/api/v1/categories
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
Lines changed: 68 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
0 commit comments