Skip to content

Commit

Permalink
fix: unable to edit note in the Reviewer
Browse files Browse the repository at this point in the history
`undoableOp` was used in REVIEWER, but not sent

Cause: 74487d3

`updateNote` was removed from the CardViewer
and the tests were updated to assume that NoteEditor
did this.

I did not realise that `undoableOp` was ONLY sent
if the receiver was the Previewer

and falsely presumed testing in the Previewer was
testing AbstractFlashcardViewer

Fixes 15526
  • Loading branch information
david-allison authored and mikehardy committed Feb 16, 2024
1 parent bfbd160 commit 7e21b4d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1006,17 +1006,18 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
mEditorNote!!.setTagsFromStr(getColUnsafe, tagsAsString(mSelectedTags!!))
changed = true

if (caller != CALLER_PREVIEWER_EDIT) {
closeNoteEditor()
return
}

withProgress {
undoableOp {
updateNote(mCurrentEditedCard!!.note())
// these activities are updated to handle `opChanges`
// and no longer using the legacy ActivityResultCallback/onActivityResult to
// accept & update the note in the activity
if (caller == CALLER_PREVIEWER_EDIT || caller == CALLER_REVIEWER_EDIT) {
withProgress {
undoableOp {
updateNote(mCurrentEditedCard!!.note())
}
}
closeNoteEditor()
}
closeNoteEditor()
return
}
}

Expand Down

0 comments on commit 7e21b4d

Please sign in to comment.