Description
Adds a "Load more" button to the activity list. By default only the 10 newest activities are displayed in the side bar, older activities can be loaded with the new button.
Fixes #12
Type of change
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] My changes generate no new warnings
[x] Any dependent changes have been merged and published in downstream module
Expected Outcome
Additional Information
I extended the activities API with last and limit query parameters. To ensure consistency when retrieving more activities (f.e. when someone else created a new activity while on the page) I use the id of the last activity visible, instead of just skipping 10 items.
The API also returns a new "X-Has-More" header flag, which indicates if more activities are available. I had "X-Total-Count" first, but I think this is a better indicator if there are really more activities to load. Additionally I can set that flag with loading limit + 1, instead of additionally executing Activity.countDocuments({ boardId: _id }).
Description Adds a "Load more" button to the activity list. By default only the 10 newest activities are displayed in the side bar, older activities can be loaded with the new button.
Fixes #12
Type of change
Checklist
Expected Outcome
Additional Information I extended the activities API with last and limit query parameters. To ensure consistency when retrieving more activities (f.e. when someone else created a new activity while on the page) I use the id of the last activity visible, instead of just skipping 10 items.
The API also returns a new "X-Has-More" header flag, which indicates if more activities are available. I had "X-Total-Count" first, but I think this is a better indicator if there are really more activities to load. Additionally I can set that flag with loading limit + 1, instead of additionally executing
Activity.countDocuments({ boardId: _id })
.