Skip to content

Commit

Permalink
Merge pull request #6518 from nextcloud/backport/detect-end-of-activi…
Browse files Browse the repository at this point in the history
…ty-stream-stable23

stable23: fix: Detect end of the activity responses (fix #3395)
  • Loading branch information
juliusknorr authored Nov 18, 2024
2 parents 1c74fda + 55004b9 commit 1443fd2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/ActivityList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,20 @@ export default {
params.append('object_id', '' + this.objectId)
params.append('limit', ACTIVITY_FETCH_LIMIT)

const response = await axios.get(generateOcsUrl(`apps/activity/api/v2/activity/${this.filter}`) + '?' + params)
const response = await axios.get(
generateOcsUrl(`apps/activity/api/v2/activity/${this.filter}`) + '?' + params,
{
validateStatus: (status) => {
return (status >= 200 && status < 300) || status === 304
},
},
)

if (response.status === 304) {
this.endReached = true
return []
}

let activities = response.data.ocs.data
if (this.filter === 'deck') {
// We need to manually filter activities here, since currently we use two different types and there is no way
Expand All @@ -95,7 +108,7 @@ export default {
})
}
this.activities.push(...activities)
if (response.data.ocs.meta.statuscode === 304 || activities.length === 0) {
if (activities.length === 0) {
this.endReached = true
return []
}
Expand Down

0 comments on commit 1443fd2

Please sign in to comment.