|
|
|
|
@ -608,9 +608,9 @@
|
|
|
|
|
user: false,
|
|
|
|
|
timeline: [],
|
|
|
|
|
timelinePage: 2,
|
|
|
|
|
min_id: 0,
|
|
|
|
|
max_id: 0,
|
|
|
|
|
cursor: undefined,
|
|
|
|
|
loading: true,
|
|
|
|
|
canLoadMore: false,
|
|
|
|
|
owner: false,
|
|
|
|
|
layout: 'metro',
|
|
|
|
|
mode: 'grid',
|
|
|
|
|
@ -726,21 +726,33 @@
|
|
|
|
|
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
|
|
|
|
|
axios.get(apiUrl, {
|
|
|
|
|
params: {
|
|
|
|
|
limit: 9,
|
|
|
|
|
pinned: true,
|
|
|
|
|
only_media: true,
|
|
|
|
|
min_id: 1,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
let data = res.data.filter(status => status.media_attachments.length > 0);
|
|
|
|
|
let ids = data.map(status => status.id);
|
|
|
|
|
this.ids = ids;
|
|
|
|
|
this.min_id = Math.max(...ids);
|
|
|
|
|
this.max_id = Math.min(...ids);
|
|
|
|
|
if(res.headers && res.headers.link) {
|
|
|
|
|
const links = parseLinkHeader(res.headers.link);
|
|
|
|
|
if(links.prev) {
|
|
|
|
|
this.cursor = links.prev.cursor;
|
|
|
|
|
this.canLoadMore = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.cursor = null;
|
|
|
|
|
this.canLoadMore = false;
|
|
|
|
|
$state.complete();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.cursor = null;
|
|
|
|
|
this.canLoadMore = false;
|
|
|
|
|
}
|
|
|
|
|
this.modalStatus = _.first(res.data);
|
|
|
|
|
this.timeline = data;
|
|
|
|
|
this.ownerCheck();
|
|
|
|
|
this.loading = false;
|
|
|
|
|
//this.loadSponsor();
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
swal('Oops, something went wrong',
|
|
|
|
|
'Please release the page.',
|
|
|
|
|
@ -757,18 +769,20 @@
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
infiniteTimeline($state) {
|
|
|
|
|
if(this.loading || this.timeline.length < 9) {
|
|
|
|
|
$state.complete();
|
|
|
|
|
if(this.loading || !this.cursor || !this.canLoadMore) {
|
|
|
|
|
// $state.complete();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
|
|
|
|
|
axios.get(apiUrl, {
|
|
|
|
|
params: {
|
|
|
|
|
limit: 9,
|
|
|
|
|
pinned: true,
|
|
|
|
|
only_media: true,
|
|
|
|
|
max_id: this.max_id
|
|
|
|
|
cursor: this.cursor,
|
|
|
|
|
},
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res.data.length && this.loading == false) {
|
|
|
|
|
if (res.data.length) {
|
|
|
|
|
let data = res.data;
|
|
|
|
|
let self = this;
|
|
|
|
|
data.forEach(d => {
|
|
|
|
|
@ -777,13 +791,20 @@
|
|
|
|
|
self.ids.push(d.id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
let max = Math.min(...this.ids);
|
|
|
|
|
if(max == this.max_id) {
|
|
|
|
|
if(res.headers && res.headers.link) {
|
|
|
|
|
const links = parseLinkHeader(res.headers.link);
|
|
|
|
|
if(links.prev) {
|
|
|
|
|
this.cursor = links.prev.cursor;
|
|
|
|
|
this.canLoadMore = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.cursor = null;
|
|
|
|
|
this.canLoadMore = false;
|
|
|
|
|
$state.complete();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.min_id = Math.max(...this.ids);
|
|
|
|
|
this.max_id = max;
|
|
|
|
|
} else {
|
|
|
|
|
this.cursor = null;
|
|
|
|
|
this.canLoadMore = false;
|
|
|
|
|
}
|
|
|
|
|
$state.loaded();
|
|
|
|
|
this.loading = false;
|
|
|
|
|
} else {
|
|
|
|
|
|