diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 9aec62985..4fc5984a9 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -484,8 +484,6 @@ size="sm" body-class="list-group-flush p-0 rounded">
-
Embed
Copy Link
{{ showComments ? 'Disable' : 'Enable'}} Comments
@@ -1605,34 +1603,6 @@ export default { return; }, - ctxMenuFollow() { - let id = this.status.account.id; - axios.post('/i/follow', { - item: id - }).then(res => { - let username = this.status.account.acct; - this.relationship.following = true; - this.$refs.ctxModal.hide(); - setTimeout(function() { - swal('Follow successful!', 'You are now following ' + username, 'success'); - }, 500); - }); - }, - - ctxMenuUnfollow() { - let id = this.status.account.id; - axios.post('/i/follow', { - item: id - }).then(res => { - let username = this.status.account.acct; - this.relationship.following = false; - this.$refs.ctxModal.hide(); - setTimeout(function() { - swal('Unfollow successful!', 'You are no longer following ' + username, 'success'); - }, 500); - }); - }, - archivePost(status) { if(window.confirm('Are you sure you want to archive this post?') == false) { return; diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 160a3ea10..991d4ab62 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -342,7 +342,7 @@
- +

@@ -397,7 +397,7 @@

- +

@@ -1049,19 +1049,22 @@ if($('body').hasClass('loggedIn') == false) { return; } - axios.post('/i/follow', { - item: this.profileId - }).then(res => { - this.$refs.visitorContextMenu.hide(); - if(this.relationship.following) { + this.$refs.visitorContextMenu.hide(); + const curState = this.relationship.following; + const apiUrl = curState ? + '/api/v1/accounts/' + this.profileId + '/unfollow' : + '/api/v1/accounts/' + this.profileId + '/follow'; + axios.post(apiUrl) + .then(res => { + if(curState) { this.profile.followers_count--; - if(this.profile.locked == true) { - window.location.href = '/'; + if(this.profile.locked) { + location.reload(); } } else { this.profile.followers_count++; } - this.relationship.following = !this.relationship.following; + this.relationship = res.data; }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); @@ -1218,9 +1221,11 @@ }, followModalAction(id, index, type = 'following') { - axios.post('/i/follow', { - item: id - }).then(res => { + const apiUrl = type === 'following' ? + '/api/v1/accounts/' + id + '/unfollow' : + '/api/v1/accounts/' + id + '/follow'; + axios.post(apiUrl) + .then(res => { if(type == 'following') { this.following.splice(index, 1); this.profile.following_count--; diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index a29f3054a..246722b21 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -379,26 +379,6 @@ export default { this.searchContext(this.analysis); }, - followProfile(profile, index) { - this.loading = true; - axios.post('/i/follow', { - item: profile.entity.id - }).then(res => { - if(profile.entity.local == true) { - this.fetchSearchResults(); - return; - } else { - this.loading = false; - this.results.profiles[index].entity.follow_request = true; - return; - } - }).catch(err => { - if(err.response.data.message) { - swal('Error', err.response.data.message, 'error'); - } - }); - }, - searchLexer() { let q = this.query; diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 62358c218..333561567 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -283,21 +283,21 @@

-->
+
+ +

{{formatCount(profile.statuses_count)}}

+

Posts

+
+ +

{{formatCount(profile.followers_count)}}

+

Followers

+
+ +

{{formatCount(profile.following_count)}}

+

Following

+
+
+
@@ -324,7 +324,6 @@

{{rec.message}}

- Follow
@@ -761,24 +760,6 @@ }) }, - expRecFollow(id, index) { - return; - - if(this.config.ab.rec == false) { - return; - } - - axios.post('/i/follow', { - item: id - }).then(res => { - this.suggestions.splice(index, 1); - }).catch(err => { - if(err.response.data.message) { - swal('Error', err.response.data.message, 'error'); - } - }); - }, - owner(status) { return this.profile.id === status.account.id; }, @@ -865,34 +846,34 @@ }, commentFocus(status, $event) { - if(status.comments_disabled) { - return; - } + if(status.comments_disabled) { + return; + } - // if(this.status && this.status.id == status.id) { - // this.$refs.replyModal.show(); - // return; - // } + // if(this.status && this.status.id == status.id) { + // this.$refs.replyModal.show(); + // return; + // } - this.status = status; - this.replies = {}; - this.replyStatus = {}; - this.replyText = ''; - this.replyId = status.id; - this.replyStatus = status; - // this.$refs.replyModal.show(); - this.fetchStatusComments(status, ''); + this.status = status; + this.replies = {}; + this.replyStatus = {}; + this.replyText = ''; + this.replyId = status.id; + this.replyStatus = status; + // this.$refs.replyModal.show(); + this.fetchStatusComments(status, ''); - $('nav').hide(); - $('footer').hide(); - $('.mobile-footer-spacer').attr('style', 'display:none !important'); - $('.mobile-footer').attr('style', 'display:none !important'); - this.currentLayout = 'comments'; - window.history.pushState({}, '', this.statusUrl(status)); - return; - }, + $('nav').hide(); + $('footer').hide(); + $('.mobile-footer-spacer').attr('style', 'display:none !important'); + $('.mobile-footer').attr('style', 'display:none !important'); + this.currentLayout = 'comments'; + window.history.pushState({}, '', this.statusUrl(status)); + return; + }, - fetchStatusComments(status, card) { + fetchStatusComments(status, card) { let url = '/api/v2/comments/'+status.account.id+'/status/'+status.id; axios.get(url) .then(response => { diff --git a/resources/assets/js/components/partials/ContextMenu.vue b/resources/assets/js/components/partials/ContextMenu.vue index 91711b034..1533b3cad 100644 --- a/resources/assets/js/components/partials/ContextMenu.vue +++ b/resources/assets/js/components/partials/ContextMenu.vue @@ -9,8 +9,6 @@ size="sm" body-class="list-group-flush p-0 rounded">
-
View Post
View Profile