mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-11 14:40:46 +00:00
Update Profile.vue
This commit is contained in:
parent
c747e37235
commit
ea411f2e99
1 changed files with 23 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
||||||
<span class="pl-4" v-if="owner">
|
<span class="pl-4" v-if="owner">
|
||||||
<a class="fas fa-cog fa-lg text-muted" href="/settings/home"></a>
|
<a class="fas fa-cog fa-lg text-muted" href="/settings/home"></a>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="!owner && user.hasOwnProperty('id')">
|
<span v-if="profile.id != user.id && user.hasOwnProperty('id')">
|
||||||
<span class="pl-4" v-if="relationship.following == true">
|
<span class="pl-4" v-if="relationship.following == true">
|
||||||
<button type="button" class="btn btn-outline-secondary font-weight-bold px-4 py-0" v-on:click="followProfile()">Unfollow</button>
|
<button type="button" class="btn btn-outline-secondary font-weight-bold px-4 py-0" v-on:click="followProfile()">Unfollow</button>
|
||||||
</span>
|
</span>
|
||||||
|
@ -213,10 +213,12 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<infinite-loading @infinite="infiniteTimeline">
|
<div v-if="timeline.length">
|
||||||
<div slot="no-more"></div>
|
<infinite-loading @infinite="infiniteTimeline">
|
||||||
<div slot="no-results"></div>
|
<div slot="no-more"></div>
|
||||||
</infinite-loading>
|
<div slot="no-results"></div>
|
||||||
|
</infinite-loading>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -324,6 +326,8 @@ export default {
|
||||||
user: {},
|
user: {},
|
||||||
timeline: [],
|
timeline: [],
|
||||||
timelinePage: 2,
|
timelinePage: 2,
|
||||||
|
min_id: 0,
|
||||||
|
max_id: 0,
|
||||||
loading: true,
|
loading: true,
|
||||||
owner: false,
|
owner: false,
|
||||||
mode: 'grid',
|
mode: 'grid',
|
||||||
|
@ -368,11 +372,15 @@ export default {
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
params: {
|
params: {
|
||||||
only_media: true,
|
only_media: true,
|
||||||
page: 1,
|
min_id: 1,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.timeline = res.data;
|
let data = res.data;
|
||||||
|
this.timeline = data;
|
||||||
|
let ids = data.map(status => status.id);
|
||||||
|
this.min_id = Math.max(...ids);
|
||||||
|
this.max_id = Math.min(...ids);
|
||||||
this.modalStatus = _.first(res.data);
|
this.modalStatus = _.first(res.data);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.ownerCheck();
|
this.ownerCheck();
|
||||||
|
@ -393,14 +401,16 @@ export default {
|
||||||
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
|
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
params: {
|
params: {
|
||||||
page: this.timelinePage,
|
only_media: true,
|
||||||
only_media: true
|
max_id: this.max_id
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.length && this.loading == false) {
|
if (res.data.length && this.loading == false) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
this.timeline.push(...data);
|
this.timeline.push(...data);
|
||||||
this.timelinePage += 1;
|
let ids = data.map(status => status.id);
|
||||||
|
this.max_id = Math.min(...ids);
|
||||||
|
this.loading = false;
|
||||||
$state.loaded();
|
$state.loaded();
|
||||||
} else {
|
} else {
|
||||||
$state.complete();
|
$state.complete();
|
||||||
|
@ -651,6 +661,9 @@ export default {
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(this.relationship.following) {
|
if(this.relationship.following) {
|
||||||
this.profile.followers_count--;
|
this.profile.followers_count--;
|
||||||
|
if(this.profile.locked == true) {
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.profile.followers_count++;
|
this.profile.followers_count++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue