Skip to content

Commit bafbd83

Browse files
Fixed possiblity to have the same entry in watch list and ignore list
1 parent d9093f3 commit bafbd83

File tree

1 file changed

+7
-2
lines changed
  • manami-app/src/main/kotlin/io/github/manamiproject/manami/app/state

1 file changed

+7
-2
lines changed

manami-app/src/main/kotlin/io/github/manamiproject/manami/app/state/InternalState.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ internal object InternalState : State {
3737

3838
override fun addAllAnimeListEntries(anime: Collection<AnimeListEntry>) {
3939
animeList.addAll(anime.distinct())
40+
4041
val uris = anime.map { it.link }.filterIsInstance<Link>().map { it.uri }.toSet()
4142
watchList.removeIf { uris.contains(it.link.uri) }
4243
ignoreList.removeIf { uris.contains(it.link.uri) }
@@ -50,7 +51,9 @@ internal object InternalState : State {
5051

5152
override fun addAllWatchListEntries(anime: Collection<WatchListEntry>) {
5253
watchList.addAll(anime.distinct())
53-
ignoreList.removeAll(anime.map { IgnoreListEntry(it) })
54+
55+
val uris = anime.map { it.link.uri }.toSet()
56+
ignoreList.removeIf { uris.contains(it.link.uri) }
5457
}
5558

5659
override fun removeWatchListEntry(entry: WatchListEntry) {
@@ -61,7 +64,9 @@ internal object InternalState : State {
6164

6265
override fun addAllIgnoreListEntries(anime: Collection<IgnoreListEntry>) {
6366
ignoreList.addAll(anime.distinct())
64-
watchList.removeAll(anime.map { WatchListEntry(it) })
67+
68+
val uris = anime.map { it.link.uri }.toSet()
69+
watchList.removeIf { uris.contains(it.link.uri) }
6570
}
6671

6772
override fun removeIgnoreListEntry(entry: IgnoreListEntry) {

0 commit comments

Comments
 (0)