Commit 96d7e6b
committed
FIX: AI search discoveries user preference not saving
The "Enable AI search discoveries" checkbox in user preferences
wasn't persisting changes. The UI showed "saved" but the value
never reached the database.
The Interface controller's `saveAttrNames` is a computed property
that returns a new array on each access. While the plugin called
`addSaveableUserOptionField()`, this only registers the field with
the User model. The controller filters which fields to save via
`saveAttrNames`, and since `ai_search_discoveries` wasn't in that
list, it was excluded from the save request.
Fix by using `modifyClass` to extend the controller's `save()`
action, pushing `ai_search_discoveries` to `saveAttrNames` at the
moment of saving before calling the parent method.
Ref - meta/t/3911351 parent c0e9e4b commit 96d7e6b
File tree
2 files changed
+29
-1
lines changed- plugins/discourse-ai
- assets/javascripts/discourse/initializers
- spec/system
2 files changed
+29
-1
lines changedLines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
14 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
15 | 30 | | |
16 | 31 | | |
17 | 32 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | 42 | | |
30 | 43 | | |
| |||
0 commit comments