diff --git a/resources/assets/components/Post.vue b/resources/assets/components/Post.vue index 1cc57c84e..6b3361351 100644 --- a/resources/assets/components/Post.vue +++ b/resources/assets/components/Post.vue @@ -37,6 +37,8 @@ v-on:bookmark="handleBookmark()" v-on:share="shareStatus()" v-on:unshare="unshareStatus()" + v-on:follow="follow()" + v-on:unfollow="unfollow()" v-on:counter-change="counterChange" /> @@ -333,6 +335,30 @@ }) }, + follow() { + axios.post('/api/v1/accounts/' + this.post.account.id + '/follow') + .then(res => { + this.$store.commit('updateRelationship', [res.data]); + this.user.following_count++; + this.post.account.followers_count++; + }).catch(err => { + swal('Oops!', 'An error occurred when attempting to follow this account.', 'error'); + this.post.relationship.following = false; + }); + }, + + unfollow() { + axios.post('/api/v1/accounts/' + this.post.account.id + '/unfollow') + .then(res => { + this.$store.commit('updateRelationship', [res.data]); + this.user.following_count--; + this.post.account.followers_count--; + }).catch(err => { + swal('Oops!', 'An error occurred when attempting to unfollow this account.', 'error'); + this.post.relationship.following = true; + }); + }, + openContextMenu() { this.$nextTick(() => { this.$refs.contextMenu.open(); diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index 745284859..fd18b0fc9 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -1084,6 +1084,16 @@ export default { return App.util.format.timeAgo(ts); }, + formatBytes(bytes, decimals = 2) { + if (!+bytes) { + return '0 Bytes' + } + const dec = decimals < 0 ? 0 : decimals + const units = ['Bytes', 'KB', 'MB', 'GB', 'TB']; + const quotient = Math.floor(Math.log(bytes) / Math.log(1024)) + return `${parseFloat((bytes / Math.pow(1024, quotient)).toFixed(dec))} ${units[quotient]}` + }, + fetchProfile() { let tags = { public: 'Public', @@ -1194,6 +1204,13 @@ export default { }, 300); }).catch(function(e) { switch(e.response.status) { + case 413: + self.uploading = false; + io.value = null; + swal('File is too large', 'The file you uploaded has the size of ' + self.formatBytes(io.size) + '. Unfortunately, only images up to ' + self.formatBytes(self.config.uploader.max_photo_size * 1024) + ' are supported.\nPlease resize the file and try again.', 'error'); + self.page = 2; + break; + case 451: self.uploading = false; io.value = null; diff --git a/resources/views/profile/show.blade.php b/resources/views/profile/show.blade.php index d16eeb7c0..5107c0ab3 100644 --- a/resources/views/profile/show.blade.php +++ b/resources/views/profile/show.blade.php @@ -20,7 +20,7 @@ @endsection -@push('meta') +@push('meta') @if(false == $settings['crawlable'] || $profile->remote_url) @else