Saving the split view editor restores a renamed tag
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the regression test shown in CardBrowserTest.kt, which renames a tag while the split view editor is open and then saves a note. Trace how the editor retains and saves note tags across the activity pause and resume, using the split pane editor and tag management paths as entry points. Done means the renamed tag remains "bar" after saving the edited note; run the focused CardBrowserTest.
Written by the indexing model from the issue text.
Description
Subject: [EXISTING] Saving the split view editor restores a renamed tag
On a tablet split view, renaming a tag in Manage tags and then saving the note in the editor pane writes the old tag back.
⚠️ This issue existed before the PR and should likely be split off into a separate issue. This PR adds a new way to trigger it from the browser's tag options.
---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt
index dded6222a3..4074346b4f 100644
--- a/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserTest.kt
@@ -92,6 +92,8 @@ import com.ichi2.anki.model.SelectableDeck
import com.ichi2.anki.model.SortType
import com.ichi2.anki.noteeditor.toIntent
import com.ichi2.anki.observability.undoableOp
+import com.ichi2.anki.tags.ManageTagsViewModel
+import com.ichi2.anki.tags.TagName
import com.ichi2.anki.scheduling.ForgetCardsDialog
import com.ichi2.anki.servicelayer.PreferenceUpgradeService
import com.ichi2.anki.servicelayer.PreferenceUpgradeService.PreferenceUpgrade.UpgradeBrowserColumns.Companion.LEGACY_COLUMN1_KEYS
@@ -1678,6 +1680,39 @@ class CardBrowserTest : RobolectricTest() {
}
}
+ @Test
+ fun `a tag renamed in manage tags is not restored by saving the note editor pane`() =
+ runTest {
+ val note = addBasicNote("Hello", "World").update { addTag("foo") }
+ setCardBrowserFragmented(true)
+ withSplitPaneUiAsync {
+ ensureCollectionLoadIsSynchronous()
+ val controller = startActivityControllerNormallyOpenCollectionWithIntent(CardBrowser::class.java, Intent())
+ val browser = controller.get()
+ browser.waitForSearchResults()
+ browser.viewModel.setQuery("deck:\"Default\"", forceRefresh = true)
+ advanceRobolectricLooper()
+ browser.cardBrowserFragment.openNoteEditorForCurrentlySelectedRow()
+ advanceRobolectricLooper()
+
+ // Manage tags covers the browser while the tag is renamed
+ controller.pause().stop()
+ val manageTags = ManageTagsViewModel()
+ manageTags.refreshTags().join()
+ manageTags.renameTag(requireNotNull(TagName.build("foo")), requireNotNull(TagName.build("bar"))).join()
+ assertEquals(listOf("bar"), col.getNote(note.id).tags)
+ controller.start().resume()
+ advanceRobolectricLooper()
+
+ val editor = requireNotNull(browser.fragment) { "note editor unloaded" }
+ editor.setFieldValueFromUi(0, "Hello edited")
+ editor.saveNote()
+ advanceRobolectricLooper()
+
+ assertEquals(listOf("bar"), col.getNote(note.id).tags)
+ }
+ }
+
/**
* see issue 15609
*/
Originally posted by @criticalAY in https://github.com/ankidroid/Anki-Android/pull/22849#pullrequestreview-5875655840
- Dominant language
- Kotlin
- Stars
- 12.3k
- Forks
- 3.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 383
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ankidroid/Anki-Android
-
Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23392 ·
Maintainers usually reply within 1 day
-
Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23390 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ankidroid/Anki-Android#23385 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ankidroid/Anki-Android#23374 ·
Maintainers usually reply within 1 day
-
Selected custom-study tags become unreadablePossibly taken @chesh-ire claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ankidroid/Anki-Android#23352 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in ankidroid/Anki-Android
Similar issues
-
Bug Domain changed
Difficulty 1/5 Under an hour Newbie friendliness 79/100
keiyoushi/extensions-source#21174 ·
Maintainers usually reply within 1 day
-
Unified account interface not translated into Simplified ChinesePossibly taken @xuenhua claimed this 3 days ago. Openunconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
thunderbird/thunderbird-android#11936 · 1 comment ·
Maintainers usually reply within 3 days
-
Update toast stylingOpendesign good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
scribe-org/Scribe-Android#778 ·
Maintainers usually reply within 1 day
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
valkey-io/valkey-glide#7772 ·
Maintainers usually reply within 1 day
-
Error Handling Swift
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/wordpress-rs#1759 ·
Maintainers usually reply within 1 day