Skip to content

Commit e1bd644

Browse files
lukstbitmikehardy
authored andcommitted
Fix filtered deck being displayed in InstantNoteEditorActivity
If a filtered deck is selected and we use the InstantNoteEditorActivity to add cards, the filtered deck will be displayed in the deck selector although we can't add to a filtered deck(the actual code handles this by adding to the 'Default' deck). The fix consists in showing the 'Default' deck so a user it's not confused about the deck where his new card will go.
1 parent b889403 commit e1bd644

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/instantnoteeditor/InstantEditorViewModel.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import com.ichi2.anki.OnErrorListener
2828
import com.ichi2.anki.checkNoteFieldsResponse
2929
import com.ichi2.anki.instantnoteeditor.InstantNoteEditorActivity.DialogType
3030
import com.ichi2.anki.libanki.DeckId
31-
import com.ichi2.anki.libanki.Decks
3231
import com.ichi2.anki.libanki.Note
3332
import com.ichi2.anki.libanki.NotetypeJson
3433
import com.ichi2.anki.observability.undoableOp
34+
import com.ichi2.anki.selectedDeckIfNotFiltered
3535
import com.ichi2.anki.utils.ext.getAllClozeTextFields
3636
import kotlinx.coroutines.flow.MutableSharedFlow
3737
import kotlinx.coroutines.flow.MutableStateFlow
@@ -104,9 +104,8 @@ class InstantEditorViewModel :
104104
init {
105105
viewModelScope.launch {
106106
// setup the deck Id
107-
withCol { config.get<Long?>(Decks.CURRENT_DECK) ?: 1L }.let { did ->
108-
deckId = did
109-
}
107+
val selectedDeck = withCol { selectedDeckIfNotFiltered() }
108+
deckId = selectedDeck.id
110109

111110
// setup the note type
112111
// TODO: Use did here

0 commit comments

Comments
 (0)