Commit 1bc80b9
[OP-19964] Fix 500 when creating a meeting outcome with an invalid kind (#24771)
* Fix 500 when creating a meeting outcome with an invalid kind
MeetingOutcome's kind enum was declared without validate: true, so
assigning an unrecognized value raised a raw Rails ArgumentError
instead of a normal ActiveModel validation error, propagating uncaught
through the API endpoint as a 500.
Add validate: true to the enum declaration -- Rails then rejects an
out-of-enum value through the usual validation path, returning a clean
422.
* Add missing MeetingOutcome#kind locale entry
CI's Units + Features job caught this live: the earlier fix in this PR
(validate: true on the kind enum) means Rails now builds a real
ActiveModel error message on an invalid kind, which needs
human_attribute_name for the attribute -- a key that never existed for
MeetingOutcome. Without it, the 422 path itself crashed with
I18n::MissingTranslationData instead of returning the intended
validation error. Verified live: before this entry, requesting
'activerecord.attributes.meeting_outcome.kind' raised; after, it
resolves to "Kind" and the full validation message reads "Kind is not
set to one of the allowed values."
* Refactor meeting_section localization entries
Removed duplicate meeting_section entries and adjusted presenter position.
* Fix missing keys
* Drop regression-test comment restating the PR description; fix stray trailing whitespace
The trailing whitespace after "Title" was an unrelated artifact of the
original diff's line touch.
---------
Co-authored-by: Oliver Günther <o.guenther@openproject.com>
Co-authored-by: Oliver Günther <mail@oliverguenther.de>1 parent 929e697 commit 1bc80b9
3 files changed
Lines changed: 26 additions & 1 deletion
File tree
- modules/meeting
- app/models
- config/locales
- spec/requests/api/v3/meeting_outcomes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
162 | 185 | | |
163 | 186 | | |
164 | 187 | | |
| |||
0 commit comments