From 13aaf6441273d6fb6e83c7ea2937645132c713de Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 3 Dec 2018 13:17:46 -0700 Subject: [PATCH 1/2] Update StatusController --- app/Http/Controllers/StatusController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 605470f78..f25042318 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -142,7 +142,6 @@ class StatusController extends Controller $this->authCheck(); $this->validate($request, [ - 'type' => 'required|string', 'item' => 'required|integer|min:1', ]); From e4abd9b03f462212f5616b5c0b9309f6ede37cc7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 3 Dec 2018 13:23:22 -0700 Subject: [PATCH 2/2] Fixes #596 --- config/pixelfed.php | 2 +- public/js/components.js | Bin 557668 -> 557836 bytes public/mix-manifest.json | Bin 321 -> 321 bytes .../assets/js/components/PostComponent.vue | 214 +++++++++++++----- 4 files changed, 153 insertions(+), 63 deletions(-) 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 5e94f3a611f711fe5047e24ecbd26a74ce952bfd..02c71c18d7aca78a7753a9f330ee1082b691571f 100644 GIT binary patch delta 4117 zcmeHKdvp}l89(>VY<49OHV=}JK$)GS$!?gPBx3PoaZSS0GopDQW{}1>WGBh6o0(*0 zHV>C2;^7pIM-iCnt$iqJv1;`QjWAWjV@q4>KNRdA#ezN11BYr4(Dbx_s7LHKvw0c9 z>ErMIv2$m>`@8r4zQ_H(Z!hj-AO8+}Xl#?GuC67?l3yJ692%|Je91#M)@f_WzR&38 zv(1OuqVn61hQL{%e_@p80yb`M~53+opW|(2A(^NFoVEA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-manifest.json index 4fd418d4d5098574a3c3a09cb3aaaaca080f877d..aef4edbb9d49a91a532d43e145989be1bed1d6b0 100644 GIT binary patch delta 30 lcmX@ebdYI+p-5_~sYzmzv6+E!nu(F2ahj2dk?BO&KLCz(2~z+7 delta 30 lcmX@ebdYI+p@^YHYMP;;si9$Vnz@-}im_R;dD2AJKLCsd36lT- 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