mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update Profile component
This commit is contained in:
parent
1646b640c9
commit
5b720b239e
1 changed files with 46 additions and 107 deletions
|
@ -375,7 +375,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="following.length == 0" class="list-group-item border-0">
|
<div v-if="following.length == 0" class="list-group-item border-0">
|
||||||
<div class="list-group-item border-0">
|
<div class="list-group-item border-0">
|
||||||
<p class="p-3 text-center mb-0 lead">You are not following anyone.</p>
|
<p class="p-3 text-center mb-0 lead"></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="followingMore" class="list-group-item text-center" v-on:click="followingLoadMore()">
|
<div v-if="followingMore" class="list-group-item text-center" v-on:click="followingLoadMore()">
|
||||||
|
@ -571,6 +571,17 @@
|
||||||
this.mode = u.get('t');
|
this.mode = u.get('t');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
let u = new URLSearchParams(window.location.search);
|
||||||
|
if(u.has('md') && u.get('md') == 'followers') {
|
||||||
|
this.followersModal();
|
||||||
|
}
|
||||||
|
if(u.has('md') && u.get('md') == 'following') {
|
||||||
|
this.followingModal();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updated() {
|
updated() {
|
||||||
|
@ -780,33 +791,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchStatusComments(status, card) {
|
|
||||||
axios.get('/api/v2/status/'+status.id+'/replies')
|
|
||||||
.then(res => {
|
|
||||||
let comments = card.querySelectorAll('.comments')[0];
|
|
||||||
let data = res.data;
|
|
||||||
data.forEach(function(i, k) {
|
|
||||||
let username = document.createElement('a');
|
|
||||||
username.classList.add('font-weight-bold');
|
|
||||||
username.classList.add('text-dark');
|
|
||||||
username.classList.add('mr-2');
|
|
||||||
username.setAttribute('href', i.account.url);
|
|
||||||
username.textContent = i.account.username;
|
|
||||||
|
|
||||||
let text = document.createElement('span');
|
|
||||||
text.innerHTML = i.content;
|
|
||||||
|
|
||||||
let comment = document.createElement('p');
|
|
||||||
comment.classList.add('read-more');
|
|
||||||
comment.classList.add('mb-0');
|
|
||||||
comment.appendChild(username);
|
|
||||||
comment.appendChild(text);
|
|
||||||
comments.appendChild(comment);
|
|
||||||
});
|
|
||||||
}).catch(err => {
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
fetchRelationships() {
|
fetchRelationships() {
|
||||||
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
|
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
|
||||||
return;
|
return;
|
||||||
|
@ -878,7 +862,6 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
unblockProfile(status = null) {
|
unblockProfile(status = null) {
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
if($('body').hasClass('loggedIn') == false) {
|
||||||
return;
|
return;
|
||||||
|
@ -912,54 +895,6 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
commentSubmit(status, $event) {
|
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let id = status.id;
|
|
||||||
let form = $event.target;
|
|
||||||
let input = $(form).find('input[name="comment"]');
|
|
||||||
let comment = input.val();
|
|
||||||
let comments = form.parentElement.parentElement.getElementsByClassName('comments')[0];
|
|
||||||
axios.post('/i/comment', {
|
|
||||||
item: id,
|
|
||||||
comment: comment
|
|
||||||
}).then(res => {
|
|
||||||
input.val('');
|
|
||||||
input.blur();
|
|
||||||
|
|
||||||
let username = document.createElement('a');
|
|
||||||
username.classList.add('font-weight-bold');
|
|
||||||
username.classList.add('text-dark');
|
|
||||||
username.classList.add('mr-2');
|
|
||||||
username.setAttribute('href', this.user.url);
|
|
||||||
username.textContent = this.user.username;
|
|
||||||
|
|
||||||
let text = document.createElement('span');
|
|
||||||
text.innerHTML = comment;
|
|
||||||
|
|
||||||
let wrapper = document.createElement('p');
|
|
||||||
wrapper.classList.add('read-more');
|
|
||||||
wrapper.classList.add('mb-0');
|
|
||||||
wrapper.appendChild(username);
|
|
||||||
wrapper.appendChild(text);
|
|
||||||
comments.insertBefore(wrapper, comments.firstChild);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
statusModal(status) {
|
|
||||||
this.modalStatus = status;
|
|
||||||
this.$refs.statusModalRef.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
masonryOrientation(status) {
|
|
||||||
let o = status.media_attachments[0].orientation;
|
|
||||||
if(!o) {
|
|
||||||
o = 'square';
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
},
|
|
||||||
|
|
||||||
followProfile() {
|
followProfile() {
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
if($('body').hasClass('loggedIn') == false) {
|
||||||
return;
|
return;
|
||||||
|
@ -986,17 +921,17 @@
|
||||||
|
|
||||||
followingModal() {
|
followingModal() {
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
if($('body').hasClass('loggedIn') == false) {
|
||||||
window.location.href = encodeURI('/login?next=/' + this.profile.username + '/');
|
window.location.href = encodeURI('/login?next=/' + this.profileUsername + '/');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.profileSettings.following.list == false) {
|
if(this.profileSettings.following.list == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.following.length > 0) {
|
if(this.followingCursor > 1) {
|
||||||
this.$refs.followingModal.show();
|
this.$refs.followingModal.show();
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
|
axios.get('/api/v1/accounts/'+this.profileId+'/following', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followingCursor
|
page: this.followingCursor
|
||||||
}
|
}
|
||||||
|
@ -1009,33 +944,37 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.$refs.followingModal.show();
|
this.$refs.followingModal.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
followersModal() {
|
followersModal() {
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
if($('body').hasClass('loggedIn') == false) {
|
||||||
window.location.href = encodeURI('/login?next=/' + this.profile.username + '/');
|
window.location.href = encodeURI('/login?next=/' + this.profileUsername + '/');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.profileSettings.followers.list == false) {
|
if(this.profileSettings.followers.list == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.followers.length > 0) {
|
if(this.followerCursor > 1) {
|
||||||
this.$refs.followerModal.show();
|
this.$refs.followerModal.show();
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
|
axios.get('/api/v1/accounts/'+this.profileId+'/followers', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followerCursor
|
page: this.followerCursor
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.followers = res.data;
|
this.followers.push(...res.data);
|
||||||
this.followerCursor++;
|
this.followerCursor++;
|
||||||
if(res.data.length < 10) {
|
if(res.data.length < 10) {
|
||||||
this.followerMore = false;
|
this.followerMore = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.$refs.followerModal.show();
|
this.$refs.followerModal.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
followingLoadMore() {
|
followingLoadMore() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue