diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 18:19:11 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 18:19:11 +0900 |
| commit | 3d79e7a1361cd70d0a6264f52cfac7f16a40cae9 (patch) | |
| tree | b770c3e3104220747eb069338d045645c520e444 /src | |
| parent | Imprement promo read (diff) | |
| download | sharkey-3d79e7a1361cd70d0a6264f52cfac7f16a40cae9.tar.gz sharkey-3d79e7a1361cd70d0a6264f52cfac7f16a40cae9.tar.bz2 sharkey-3d79e7a1361cd70d0a6264f52cfac7f16a40cae9.zip | |
Improve paging
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/scripts/paging.ts | 4 | ||||
| -rw-r--r-- | src/server/api/common/inject-promo.ts | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts index 64c744e45d..3406f233c2 100644 --- a/src/client/scripts/paging.ts +++ b/src/client/scripts/paging.ts @@ -67,7 +67,7 @@ export default (opts) => ({ ...params, limit: this.pagination.noPaging ? (this.pagination.limit || 10) : (this.pagination.limit || 10) + 1, }).then(items => { - if (!this.pagination.noPaging && (items.length === (this.pagination.limit || 10) + 1)) { + if (!this.pagination.noPaging && (items.length > (this.pagination.limit || 10))) { items.pop(); this.items = this.pagination.reversed ? [...items].reverse() : items; this.more = true; @@ -103,7 +103,7 @@ export default (opts) => ({ untilId: this.items[this.items.length - 1].id, }), }).then(items => { - if (items.length === SECOND_FETCH_LIMIT + 1) { + if (items.length > SECOND_FETCH_LIMIT) { items.pop(); this.items = this.pagination.reversed ? [...items].reverse().concat(this.items) : this.items.concat(items); this.more = true; diff --git a/src/server/api/common/inject-promo.ts b/src/server/api/common/inject-promo.ts index 785d7af085..60817329c3 100644 --- a/src/server/api/common/inject-promo.ts +++ b/src/server/api/common/inject-promo.ts @@ -32,5 +32,4 @@ export async function injectPromo(user: User, timeline: Note[]) { // Inject promo timeline.splice(3, 0, note); - timeline.pop(); } |