|
|
@@ -28,7 +28,7 @@ export default class PageHistoryContainer extends Container {
|
|
|
|
|
|
totalPages: 0,
|
|
|
activePage: 1,
|
|
|
- pagingLimit: Infinity,
|
|
|
+ pagingLimit: 10,
|
|
|
};
|
|
|
|
|
|
this.retrieveRevisions = this.retrieveRevisions.bind(this);
|
|
|
@@ -50,25 +50,34 @@ export default class PageHistoryContainer extends Container {
|
|
|
*/
|
|
|
async retrieveRevisions(selectedPage) {
|
|
|
const { pageId, shareLinkId } = this.pageContainer.state;
|
|
|
+ const { pagingLimit } = this.state;
|
|
|
const page = selectedPage;
|
|
|
+ const pagingLimitForApiParam = pagingLimit + 1;
|
|
|
|
|
|
if (!pageId) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // Get one more for the bottom display
|
|
|
const res = await this.appContainer.apiv3Get('/revisions/list', {
|
|
|
- pageId, shareLinkId, page,
|
|
|
+ pageId, shareLinkId, page, limit: pagingLimitForApiParam,
|
|
|
});
|
|
|
const rev = res.data.docs;
|
|
|
// set Pagination state
|
|
|
this.setState({
|
|
|
activePage: selectedPage,
|
|
|
totalPages: res.data.totalDocs,
|
|
|
- pagingLimit: res.data.limit,
|
|
|
+ pagingLimit,
|
|
|
});
|
|
|
|
|
|
const diffOpened = {};
|
|
|
- const lastId = rev.length - 1;
|
|
|
+
|
|
|
+ let lastId = rev.length - 1;
|
|
|
+
|
|
|
+ // If the number of rev count is the same, the last rev is for diff display, so exclude it.
|
|
|
+ if (rev.length > pagingLimit) {
|
|
|
+ lastId = rev.length - 2;
|
|
|
+ }
|
|
|
|
|
|
res.data.docs.forEach((revision, i) => {
|
|
|
const user = revision.author;
|