mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 16:38:23 +01:00
Improve warp
This commit is contained in:
parent
8aaab195c6
commit
fda8cf77ed
7 changed files with 47 additions and 7 deletions
|
@ -123,7 +123,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchMore() {
|
fetchMore() {
|
||||||
if (!this.more || this.moreFetching) return;
|
if (!this.more || this.moreFetching || this.notes.length === 0) return;
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
||||||
this.notes = this.notes.concat(x.notes);
|
this.notes = this.notes.concat(x.notes);
|
||||||
|
|
|
@ -18,10 +18,12 @@ export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
connection: null,
|
connection: null,
|
||||||
|
date: null,
|
||||||
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
|
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
|
||||||
listId: this.list.id,
|
listId: this.list.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: cursor ? cursor : undefined,
|
untilId: cursor ? cursor : undefined,
|
||||||
|
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
|
||||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
||||||
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
||||||
|
@ -46,6 +48,10 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
|
this.$root.$on('warp', this.warp);
|
||||||
|
this.$once('hook:beforeDestroy', () => {
|
||||||
|
this.$root.$off('warp', this.warp);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.connection.dispose();
|
this.connection.dispose();
|
||||||
|
@ -68,6 +74,10 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
onUserRemoved() {
|
onUserRemoved() {
|
||||||
(this.$refs.timeline as any).reload();
|
(this.$refs.timeline as any).reload();
|
||||||
|
},
|
||||||
|
warp(date) {
|
||||||
|
this.date = date;
|
||||||
|
(this.$refs.timeline as any).reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,6 +36,7 @@ export default Vue.extend({
|
||||||
includeReplies: this.mode == 'with-replies',
|
includeReplies: this.mode == 'with-replies',
|
||||||
includeMyRenotes: this.mode != 'my-posts',
|
includeMyRenotes: this.mode != 'my-posts',
|
||||||
withFiles: this.mode == 'with-media',
|
withFiles: this.mode == 'with-media',
|
||||||
|
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
|
||||||
untilId: cursor ? cursor : undefined
|
untilId: cursor ? cursor : undefined
|
||||||
}).then(notes => {
|
}).then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
|
@ -62,10 +63,11 @@ export default Vue.extend({
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||||
},
|
this.$root.$on('warp', this.warp);
|
||||||
|
this.$once('hook:beforeDestroy', () => {
|
||||||
beforeDestroy() {
|
this.$root.$off('warp', this.warp);
|
||||||
document.removeEventListener('keydown', this.onDocumentKeydown);
|
document.removeEventListener('keydown', this.onDocumentKeydown);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -124,7 +124,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchMore() {
|
fetchMore() {
|
||||||
if (!this.more || this.moreFetching) return;
|
if (!this.more || this.moreFetching || this.notes.length === 0) return;
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
||||||
this.notes = this.notes.concat(x.notes);
|
this.notes = this.notes.concat(x.notes);
|
||||||
|
|
|
@ -15,10 +15,12 @@ export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
connection: null,
|
connection: null,
|
||||||
|
date: null,
|
||||||
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
|
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
|
||||||
listId: this.list.id,
|
listId: this.list.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: cursor ? cursor : undefined,
|
untilId: cursor ? cursor : undefined,
|
||||||
|
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
|
||||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
|
||||||
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
|
||||||
|
@ -45,6 +47,11 @@ export default Vue.extend({
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
|
this.$root.$on('warp', this.warp);
|
||||||
|
this.$once('hook:beforeDestroy', () => {
|
||||||
|
this.$root.$off('warp', this.warp);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -73,6 +80,11 @@ export default Vue.extend({
|
||||||
|
|
||||||
onUserRemoved() {
|
onUserRemoved() {
|
||||||
(this.$refs.timeline as any).reload();
|
(this.$refs.timeline as any).reload();
|
||||||
|
},
|
||||||
|
|
||||||
|
warp(date) {
|
||||||
|
this.date = date;
|
||||||
|
(this.$refs.timeline as any).reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,10 +17,12 @@ export default Vue.extend({
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
date: null,
|
||||||
makePromise: cursor => this.$root.api('users/notes', {
|
makePromise: cursor => this.$root.api('users/notes', {
|
||||||
userId: this.user.id,
|
userId: this.user.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
withFiles: this.withMedia,
|
withFiles: this.withMedia,
|
||||||
|
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
|
||||||
untilId: cursor ? cursor : undefined
|
untilId: cursor ? cursor : undefined
|
||||||
}).then(notes => {
|
}).then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
|
@ -37,6 +39,20 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.$root.$on('warp', this.warp);
|
||||||
|
this.$once('hook:beforeDestroy', () => {
|
||||||
|
this.$root.$off('warp', this.warp);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
warp(date) {
|
||||||
|
this.date = date;
|
||||||
|
(this.$refs.timeline as any).reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -142,7 +142,7 @@ export default define(meta, async (ps, me) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
//#region Construct query
|
//#region Construct query
|
||||||
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
|
||||||
.andWhere('note.userId = :userId', { userId: user.id })
|
.andWhere('note.userId = :userId', { userId: user.id })
|
||||||
.leftJoinAndSelect('note.user', 'user');
|
.leftJoinAndSelect('note.user', 'user');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue