mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 15:23:08 +02:00
Fix bug
This commit is contained in:
parent
100557e975
commit
d29459fa37
6 changed files with 46 additions and 12 deletions
|
@ -120,12 +120,14 @@ export default Vue.extend({
|
||||||
|
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
|
|
||||||
(this as any).api(this.endpoint, {
|
const promise = (this as any).api(this.endpoint, {
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: (this.$refs.timeline as any).tail().id,
|
untilId: (this.$refs.timeline as any).tail().id,
|
||||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,6 +136,8 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
onNote(note) {
|
onNote(note) {
|
||||||
|
|
|
@ -62,13 +62,15 @@ export default Vue.extend({
|
||||||
more() {
|
more() {
|
||||||
this.moreFetching = true;
|
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,
|
listId: this.list.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: (this.$refs.timeline as any).tail().id,
|
untilId: (this.$refs.timeline as any).tail().id,
|
||||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,6 +79,8 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
onNote(note) {
|
onNote(note) {
|
||||||
// Prepend a note
|
// Prepend a note
|
||||||
|
|
|
@ -21,6 +21,7 @@ const fetchLimit = 10;
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fetching: true,
|
fetching: true,
|
||||||
|
@ -31,19 +32,23 @@ export default Vue.extend({
|
||||||
date: null
|
date: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
mode() {
|
mode() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||||
|
|
||||||
this.fetch(() => this.$emit('loaded'));
|
this.fetch(() => this.$emit('loaded'));
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
document.removeEventListener('keydown', this.onDocumentKeydown);
|
document.removeEventListener('keydown', this.onDocumentKeydown);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onDocumentKeydown(e) {
|
onDocumentKeydown(e) {
|
||||||
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
|
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
|
||||||
|
@ -52,6 +57,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fetch(cb?) {
|
fetch(cb?) {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
|
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
|
||||||
|
@ -72,15 +78,19 @@ export default Vue.extend({
|
||||||
}, rej);
|
}, rej);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
more() {
|
more() {
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
(this as any).api('users/notes', {
|
|
||||||
|
const promise = (this as any).api('users/notes', {
|
||||||
userId: this.user.id,
|
userId: this.user.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
includeReplies: this.mode == 'with-replies',
|
includeReplies: this.mode == 'with-replies',
|
||||||
withMedia: this.mode == 'with-media',
|
withMedia: this.mode == 'with-media',
|
||||||
untilId: (this.$refs.timeline as any).tail().id
|
untilId: (this.$refs.timeline as any).tail().id
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,7 +99,10 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
warp(date) {
|
warp(date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.fetch();
|
this.fetch();
|
||||||
|
|
|
@ -77,13 +77,15 @@ export default Vue.extend({
|
||||||
|
|
||||||
this.moreFetching = true;
|
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,
|
listId: this.list.id,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: (this.$refs.timeline as any).tail().id,
|
untilId: (this.$refs.timeline as any).tail().id,
|
||||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,6 +94,8 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
onNote(note) {
|
onNote(note) {
|
||||||
|
|
|
@ -59,12 +59,15 @@ export default Vue.extend({
|
||||||
if (!this.canFetchMore) return;
|
if (!this.canFetchMore) return;
|
||||||
|
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
(this as any).api('users/notes', {
|
|
||||||
|
const promise = (this as any).api('users/notes', {
|
||||||
userId: this.user.id,
|
userId: this.user.id,
|
||||||
withMedia: this.withMedia,
|
withMedia: this.withMedia,
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: (this.$refs.timeline as any).tail().id
|
untilId: (this.$refs.timeline as any).tail().id
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,6 +76,8 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,12 +111,14 @@ export default Vue.extend({
|
||||||
|
|
||||||
this.moreFetching = true;
|
this.moreFetching = true;
|
||||||
|
|
||||||
(this as any).api(this.endpoint, {
|
const promise = (this as any).api(this.endpoint, {
|
||||||
limit: fetchLimit + 1,
|
limit: fetchLimit + 1,
|
||||||
untilId: (this.$refs.timeline as any).tail().id,
|
untilId: (this.$refs.timeline as any).tail().id,
|
||||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||||
}).then(notes => {
|
});
|
||||||
|
|
||||||
|
promise.then(notes => {
|
||||||
if (notes.length == fetchLimit + 1) {
|
if (notes.length == fetchLimit + 1) {
|
||||||
notes.pop();
|
notes.pop();
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,6 +127,8 @@ export default Vue.extend({
|
||||||
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
notes.forEach(n => (this.$refs.timeline as any).append(n));
|
||||||
this.moreFetching = false;
|
this.moreFetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
onNote(note) {
|
onNote(note) {
|
||||||
|
|
Loading…
Reference in a new issue