fix(note-editor): Deck for "new cards: decide by note type"#19734
fix(note-editor): Deck for "new cards: decide by note type"#19734mikehardy merged 3 commits intoankidroid:mainfrom
Conversation
|
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... |
There was a problem hiding this comment.
Much better than my original code because I completely missed this feature and I didn't account for it in any way:(
Things are still not working correctly when using the "Change deck depending on notetype" option. Changing notetypes while inside the editor erases the previously set deck and we revert to Default, desktop changes decks depending on selected notetypes while inside the add screen. This is also a regression from 2.22 where the proper decks were restored based on notetype selection.
Decide by notetype -> Go to add -> select a notetype and add to a deck -> select another notetype and add to another deck -> switch to the first used notetype -> deck is now Default
|
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. |
Introduced in 2644a6d Related: 19650 Fixes: 19733
Fixes 19750 Co-authored-by: lukstbit <52494258+lukstbit@users.noreply.github.com>
|
I have written two tests and applied @lukstbit's test, which fixes the second issue. Thank you for the thorough review! |
lukstbit
left a comment
There was a problem hiding this comment.
This still fixes all linked issues around decide by notetype, both the start and changing notetypes while inside the note editor screen.
Adding tests is even better, thanks!
mikehardy
left a comment
There was a problem hiding this comment.
yep - looks even better now
Purpose / Description
Introduced in 2644a6d
Fixes
Approach
col.defaultsForAdding#19650How Has This Been Tested?
Checklist