summaryrefslogtreecommitdiff
path: root/src/client/app/mobile
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-08 14:17:44 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-08 14:17:44 +0900
commit1e166490d9bd76cde3b0acaed8c678761b745e5e (patch)
tree267f23191db2131a34352907a8cf413130acbbb4 /src/client/app/mobile
parenti18n (diff)
downloadmisskey-1e166490d9bd76cde3b0acaed8c678761b745e5e.tar.gz
misskey-1e166490d9bd76cde3b0acaed8c678761b745e5e.tar.bz2
misskey-1e166490d9bd76cde3b0acaed8c678761b745e5e.zip
[Client] Better pagination
Fix #4628 Close #4629
Diffstat (limited to 'src/client/app/mobile')
-rw-r--r--src/client/app/mobile/views/components/notes.vue13
-rw-r--r--src/client/app/mobile/views/components/user-list-timeline.vue4
-rw-r--r--src/client/app/mobile/views/components/user-timeline.vue4
-rw-r--r--src/client/app/mobile/views/pages/home.timeline.vue4
-rw-r--r--src/client/app/mobile/views/pages/search.vue6
-rw-r--r--src/client/app/mobile/views/pages/tag.vue6
6 files changed, 19 insertions, 18 deletions
diff --git a/src/client/app/mobile/views/components/notes.vue b/src/client/app/mobile/views/components/notes.vue
index 7aeebde643..58fc8a6bcf 100644
--- a/src/client/app/mobile/views/components/notes.vue
+++ b/src/client/app/mobile/views/components/notes.vue
@@ -21,7 +21,7 @@
</template>
</component>
- <footer v-if="cursor != null">
+ <footer v-if="more">
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
@@ -53,7 +53,7 @@ export default Vue.extend({
fetching: true,
moreFetching: false,
inited: false,
- cursor: null
+ more: false
};
},
@@ -113,7 +113,7 @@ export default Vue.extend({
this.notes = x;
} else {
this.notes = x.notes;
- this.cursor = x.cursor;
+ this.more = x.more;
}
this.inited = true;
this.fetching = false;
@@ -124,11 +124,11 @@ export default Vue.extend({
},
more() {
- if (this.cursor == null || this.moreFetching) return;
+ if (!this.more || this.moreFetching) return;
this.moreFetching = true;
- this.makePromise(this.cursor).then(x => {
+ this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
this.notes = this.notes.concat(x.notes);
- this.cursor = x.cursor;
+ this.more = x.more;
this.moreFetching = false;
}, e => {
this.moreFetching = false;
@@ -151,6 +151,7 @@ export default Vue.extend({
// オーバーフローしたら古い投稿は捨てる
if (this.notes.length >= displayLimit) {
this.notes = this.notes.slice(0, displayLimit);
+ this.more = true;
}
} else {
this.queue.push(note);
diff --git a/src/client/app/mobile/views/components/user-list-timeline.vue b/src/client/app/mobile/views/components/user-list-timeline.vue
index e67d7931f7..c3f09c9b15 100644
--- a/src/client/app/mobile/views/components/user-list-timeline.vue
+++ b/src/client/app/mobile/views/components/user-list-timeline.vue
@@ -27,12 +27,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
- cursor: notes[notes.length - 1].id
+ more: true
};
} else {
return {
notes: notes,
- cursor: null
+ more: false
};
}
})
diff --git a/src/client/app/mobile/views/components/user-timeline.vue b/src/client/app/mobile/views/components/user-timeline.vue
index 1b73b5bc41..70016a49e3 100644
--- a/src/client/app/mobile/views/components/user-timeline.vue
+++ b/src/client/app/mobile/views/components/user-timeline.vue
@@ -27,12 +27,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
- cursor: notes[notes.length - 1].id
+ more: true
};
} else {
return {
notes: notes,
- cursor: null
+ more: false
};
}
})
diff --git a/src/client/app/mobile/views/pages/home.timeline.vue b/src/client/app/mobile/views/pages/home.timeline.vue
index 1eb7399979..36aea1ffcd 100644
--- a/src/client/app/mobile/views/pages/home.timeline.vue
+++ b/src/client/app/mobile/views/pages/home.timeline.vue
@@ -114,12 +114,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
- cursor: notes[notes.length - 1].id
+ more: true
};
} else {
return {
notes: notes,
- cursor: null
+ more: false
};
}
});
diff --git a/src/client/app/mobile/views/pages/search.vue b/src/client/app/mobile/views/pages/search.vue
index 9e4be82041..f4b2512809 100644
--- a/src/client/app/mobile/views/pages/search.vue
+++ b/src/client/app/mobile/views/pages/search.vue
@@ -21,19 +21,19 @@ export default Vue.extend({
return {
makePromise: cursor => this.$root.api('notes/search', {
limit: limit + 1,
- offset: cursor ? cursor : undefined,
+ untilId: cursor ? cursor : undefined,
query: this.q
}).then(notes => {
if (notes.length == limit + 1) {
notes.pop();
return {
notes: notes,
- cursor: cursor ? cursor + limit : limit
+ more: true
};
} else {
return {
notes: notes,
- cursor: null
+ more: false
};
}
})
diff --git a/src/client/app/mobile/views/pages/tag.vue b/src/client/app/mobile/views/pages/tag.vue
index 7a7b90dad0..f41cf1f18c 100644
--- a/src/client/app/mobile/views/pages/tag.vue
+++ b/src/client/app/mobile/views/pages/tag.vue
@@ -21,19 +21,19 @@ export default Vue.extend({
return {
makePromise: cursor => this.$root.api('notes/search-by-tag', {
limit: limit + 1,
- offset: cursor ? cursor : undefined,
+ untilId: cursor ? cursor : undefined,
tag: this.$route.params.tag
}).then(notes => {
if (notes.length == limit + 1) {
notes.pop();
return {
notes: notes,
- cursor: cursor ? cursor + limit : limit
+ more: true
};
} else {
return {
notes: notes,
- cursor: null
+ more: false
};
}
})