fix(note-editor): Deck for "new cards: decide by note type"
Purpose / Description
Introduced in 2644a6d3d5b3304df1e1681a4e609af301e17f86
- decide by note type was broken
Fixes
- Fixes #19733
Approach
- Related: #19650
How Has This Been Tested?
- Using user-provided collection
- Changed deck
- Added a new note
- Exited
- Entered
- Previously selected deck was maintained
Checklist
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [ ] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
IMO: too close to the release window to block. Save for a quick 2.23.1
This one will be cherry-picked and I feel like I understand it but asking for second set of eyes from @lukstbit since they authored the original chunk and a second set of eyes is always good for a cherry pick to a stable release...
I'm fine with this going in, the issue I mentioned existed in the previous(2.23) code as well.
Potential fix:
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditorFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditorFragment.kt
index a4141bfed8..40ba4fbd02 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditorFragment.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditorFragment.kt
@@ -2788,7 +2788,7 @@ class NoteEditorFragment :
// Update deck
if (!getColUnsafe.config.getBool(ConfigKey.Bool.ADDING_DEFAULTS_TO_CURRENT_DECK)) {
- deckId = noteType.did
+ deckId = getColUnsafe.defaultsForAdding().deckId
}
refreshNoteData(FieldChangeType.changeFieldCount(shouldReplaceNewlines()))
Drafting. Thanks!
I'd like to spend a little more time on correctness/testing before this goes in.
I have written two tests and applied @lukstbit's test, which fixes the second issue. Thank you for the thorough review!