diff --git a/config/pixelfed.php b/config/pixelfed.php index b722e8f47..26bafa108 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -23,7 +23,7 @@ return [ | This value is the version of your PixelFed instance. | */ - 'version' => '0.4.0', + 'version' => '0.4.1', /* |-------------------------------------------------------------------------- diff --git a/public/js/components.js b/public/js/components.js index 5e94f3a61..02c71c18d 100644 Binary files a/public/js/components.js and b/public/js/components.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 4fd418d4d..aef4edbb9 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 0816fc09b..6a7548a1f 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -20,26 +20,21 @@
-
+
@@ -65,26 +60,21 @@
-
+
@@ -102,31 +92,10 @@
- +

- - - -
- - - -
-
+

+

@@ -150,7 +119,6 @@
-
@@ -159,7 +127,7 @@
- + pixelfed.postComponent = {}; + pixelfed.presenter = { show: { image: function(container, media) { @@ -344,7 +313,10 @@ export default { status: {}, media: {}, user: {}, - reactions: {}, + reactions: { + liked: false, + shared: false + }, likes: {}, likesPage: 1, shares: {}, @@ -353,13 +325,13 @@ export default { }, mounted() { + this.fetchData(); + this.authCheck(); let token = $('meta[name="csrf-token"]').attr('content'); $('input[name="_token"]').each(function(k, v) { let el = $(v); el.val(token); }); - this.fetchData(); - this.authCheck(); }, updated() { @@ -390,11 +362,14 @@ export default { $('.comment-form').removeClass('d-none'); } }, + showMuteBlock() { let sid = this.status.account.id; let uid = this.user.id; - if(sid != uid) { - $('.post-actions').removeClass('d-none'); + if(sid == uid) { + $('.post-actions .menu-author').removeClass('d-none'); + } else { + $('.post-actions .menu-user').removeClass('d-none'); } }, @@ -402,6 +377,10 @@ export default { return '/i/report?type=post&id=' + this.status.id; }, + editUrl() { + return this.status.url + '/edit'; + }, + timestampFormat() { let ts = new Date(this.status.created_at); return ts.toDateString() + ' ' + ts.toLocaleTimeString(); @@ -511,12 +490,16 @@ export default { if(container.children().length != 0) { return; } - switch(this.statusTemplate) { + + let template = this.status.pf_type ? this.status.pf_type : this.statusTemplate; + switch(template) { case 'image': + case 'photo': pixelfed.presenter.show.image(container, media); break; case 'album': + case 'photo:album': pixelfed.presenter.show.imageAlbum(container, media, this.status); break; @@ -524,6 +507,12 @@ export default { pixelfed.presenter.show.video(container, media); break; + case 'video:album': + case 'photo:video:album': + $('.postPresenterLoader .lds-ring').attr('style','width:100%').addClass('pt-4 font-weight-bold text-muted').text('We cannot load this post properly. We\'re working on a fix!'); + return; + break; + default: $('.postPresenterLoader .lds-ring').attr('style','width:100%').addClass('pt-4 font-weight-bold text-muted').text('An error occured, cannot fetch media. Please try again later.'); break; @@ -537,6 +526,107 @@ export default { $('.postPresenterLoader').addClass('d-none'); $('.postPresenterContainer').removeClass('d-none'); }, + + likeStatus(event) { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/like', { + item: this.status.id + }).then(res => { + this.status.favourites_count = res.data.count; + if(this.reactions.liked == true) { + this.reactions.liked = false; + } else { + this.reactions.liked = true; + } + }).catch(err => { + swal('Error', 'Something went wrong, please try again later.', 'error'); + }); + }, + + shareStatus() { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/share', { + item: this.status.id + }).then(res => { + this.status.reblogs_count = res.data.count; + if(this.reactions.shared == true) { + this.reactions.shared = false; + } else { + this.reactions.shared = true; + } + }).catch(err => { + swal('Error', 'Something went wrong, please try again later.', 'error'); + }); + }, + + bookmarkStatus() { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/bookmark', { + item: this.status.id + }).then(res => { + if(this.reactions.bookmarked == true) { + this.reactions.bookmarked = false; + } else { + this.reactions.bookmarked = true; + } + }).catch(err => { + swal('Error', 'Something went wrong, please try again later.', 'error'); + }); + }, + + muteProfile() { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/mute', { + type: 'user', + item: this.status.account.id + }).then(res => { + swal('Success', 'You have successfully muted ' + this.status.account.acct, 'success'); + }).catch(err => { + swal('Error', 'Something went wrong. Please try again later.', 'error'); + }); + }, + + blockProfile() { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/block', { + type: 'user', + item: this.status.account.id + }).then(res => { + swal('Success', 'You have successfully blocked ' + this.status.account.acct, 'success'); + }).catch(err => { + swal('Error', 'Something went wrong. Please try again later.', 'error'); + }); + }, + + deletePost() { + if($('body').hasClass('loggedIn') == false) { + return; + } + + axios.post('/i/delete', { + type: 'status', + item: this.status.id + }).then(res => { + swal('Success', 'You have successfully deleted this post', 'success'); + }).catch(err => { + swal('Error', 'Something went wrong. Please try again later.', 'error'); + }); + } } } \ No newline at end of file