1
0
forked from mirror/misskey
This commit is contained in:
syuilo 2018-05-26 23:53:22 +09:00
parent 100557e975
commit d29459fa37
6 changed files with 46 additions and 12 deletions

View File

@ -120,12 +120,14 @@ export default Vue.extend({
this.moreFetching = true;
(this as any).api(this.endpoint, {
const promise = (this as any).api(this.endpoint, {
limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -134,6 +136,8 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
},
onNote(note) {

View File

@ -62,13 +62,15 @@ export default Vue.extend({
more() {
this.moreFetching = true;
(this as any).api('notes/user-list-timeline', {
const promise = (this as any).api('notes/user-list-timeline', {
listId: this.list.id,
limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -77,6 +79,8 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
},
onNote(note) {
// Prepend a note

View File

@ -21,6 +21,7 @@ const fetchLimit = 10;
export default Vue.extend({
props: ['user'],
data() {
return {
fetching: true,
@ -31,19 +32,23 @@ export default Vue.extend({
date: null
};
},
watch: {
mode() {
this.fetch();
}
},
mounted() {
document.addEventListener('keydown', this.onDocumentKeydown);
this.fetch(() => this.$emit('loaded'));
},
beforeDestroy() {
document.removeEventListener('keydown', this.onDocumentKeydown);
},
methods: {
onDocumentKeydown(e) {
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
@ -52,6 +57,7 @@ export default Vue.extend({
}
}
},
fetch(cb?) {
this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
@ -72,15 +78,19 @@ export default Vue.extend({
}, rej);
}));
},
more() {
this.moreFetching = true;
(this as any).api('users/notes', {
const promise = (this as any).api('users/notes', {
userId: this.user.id,
limit: fetchLimit + 1,
includeReplies: this.mode == 'with-replies',
withMedia: this.mode == 'with-media',
untilId: (this.$refs.timeline as any).tail().id
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -89,7 +99,10 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
},
warp(date) {
this.date = date;
this.fetch();

View File

@ -77,13 +77,15 @@ export default Vue.extend({
this.moreFetching = true;
(this as any).api('notes/user-list-timeline', {
const promise = (this as any).api('notes/user-list-timeline', {
listId: this.list.id,
limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -92,6 +94,8 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
},
onNote(note) {

View File

@ -59,12 +59,15 @@ export default Vue.extend({
if (!this.canFetchMore) return;
this.moreFetching = true;
(this as any).api('users/notes', {
const promise = (this as any).api('users/notes', {
userId: this.user.id,
withMedia: this.withMedia,
limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -73,6 +76,8 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
}
}
});

View File

@ -111,12 +111,14 @@ export default Vue.extend({
this.moreFetching = true;
(this as any).api(this.endpoint, {
const promise = (this as any).api(this.endpoint, {
limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
}).then(notes => {
});
promise.then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
} else {
@ -125,6 +127,8 @@ export default Vue.extend({
notes.forEach(n => (this.$refs.timeline as any).append(n));
this.moreFetching = false;
});
return promise;
},
onNote(note) {