Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Items keep popping up in Folder, All or Unread view #2835

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the
- restore old scroll behavior to scroll after articles needed for mark scroll on read (#2817)
- 25.0.0-alpha2: Feed folder bar menu always opens collapsed (#2508)
- fix: hide folder/feeds with no unread items when `showAll` is disabled (#2503)
- Items keep popping up in Folder, All or Unread view (#2833)

# Releases
## [25.0.0-alpha11] - 2024-10-19
Expand Down
9 changes: 9 additions & 0 deletions src/components/feed-display/FeedItemDisplayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ export default Vue.extend({
unreadFilter(item: FeedItem): boolean {
return item.unread
},
outOfScopeFilter(item: FeedItem): boolean {
const lastItemLoaded = this.$store.state.items.lastItemLoaded[this.fetchKey]
return (this.$store.getters.oldestFirst ? lastItemLoaded >= item.id : lastItemLoaded <= item.id)
},
toggleFilter(filter: (item: FeedItem) => boolean) {
if (this.filter === filter) {
this.filter = this.noFilter
Expand Down Expand Up @@ -270,6 +274,11 @@ export default Vue.extend({
response = response.filter(this.filter)
}

// filter items that are already loaded but do not yet match the current view (unread, all, folder...)
if (!this.fetchKey.startsWith('feed-') && this.$store.state.items.lastItemLoaded[this.fetchKey] > 0) {
response = response.filter(this.outOfScopeFilter)
}

return response.sort(this.sort)
},
// Trigger the click event programmatically to benefit from the item handling inside the FeedItemRow component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ describe('FeedItemDisplayList.vue', () => {
allItemsLoaded: {
unread: false,
},
lastItemLoaded: {
unread: 0,
},
},
},
actions: {
Expand Down
Loading