Commit 5368e347 authored by Gabriel Luong's avatar Gabriel Luong Committed by Sebastian Kaspari
Browse files

Issue #8324: Delete the pinned site from the history when removing

parent 85fcce6b
......@@ -53,13 +53,15 @@ class DefaultTopSitesStorage(
override fun removeTopSite(topSite: TopSite) {
scope.launch {
if (topSite.type == FRECENT) {
historyStorage.deleteVisitsFor(topSite.url)
notifyObservers { onStorageUpdated() }
} else {
if (topSite.type != FRECENT) {
pinnedSitesStorage.removePinnedSite(topSite)
notifyObservers { onStorageUpdated() }
}
// Remove the top site from both history and pinned sites storage to avoid having it
// show up as a frecent site if it is a pinned site.
historyStorage.deleteVisitsFor(topSite.url)
notifyObservers { onStorageUpdated() }
}
}
......
......@@ -90,6 +90,7 @@ class DefaultTopSitesStorageTest {
defaultTopSitesStorage.removeTopSite(pinnedSite)
verify(pinnedSitesStorage).removePinnedSite(pinnedSite)
verify(historyStorage).deleteVisitsFor(pinnedSite.url)
val defaultSite = TopSite(
id = 3,
......@@ -101,6 +102,7 @@ class DefaultTopSitesStorageTest {
defaultTopSitesStorage.removeTopSite(defaultSite)
verify(pinnedSitesStorage).removePinnedSite(defaultSite)
verify(historyStorage).deleteVisitsFor(defaultSite.url)
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment