From 64ff5696345286c57da5298d77d9c0900c576c2c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 18:05:50 -0700 Subject: [PATCH 1/9] Fixes #568 --- resources/assets/js/components/PostComponent.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 57ef753f5..8de6e0281 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -209,7 +209,7 @@
- November 1, 2018 + {{timestampFormat()}}
@@ -303,6 +303,10 @@ export default { pixelfed.hydrateLikes(); }, methods: { + timestampFormat() { + let ts = new Date(this.status.created_at); + return ts.toDateString(); + }, fetchData() { let url = '/api/v2/profile/'+this.statusUsername+'/status/'+this.statusId; axios.get(url) From c41e6a761d2a100f8009c9982565e1a086e0ae07 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 18:50:28 -0700 Subject: [PATCH 2/9] Update SiteController --- app/Http/Controllers/SiteController.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 8dcedd370..d1274b9dc 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -33,18 +33,14 @@ class SiteController extends Controller { $pid = Auth::user()->profile->id; // TODO: Use redis for timelines - $following = Cache::rememberForever("user:following:list:$pid", function() use($pid) { - $following = Follower::whereProfileId($pid)->pluck('following_id'); - $following->push($pid); - return $following->toArray(); - }); - $filtered = Cache::rememberForever("user:filter:list:$pid", function() use($pid) { - return UserFilter::whereUserId($pid) + $following = Follower::whereProfileId($pid)->pluck('following_id'); + $following->push($pid)->toArray(); + + $filtered = UserFilter::whereUserId($pid) ->whereFilterableType('App\Profile') ->whereIn('filter_type', ['mute', 'block']) ->pluck('filterable_id')->toArray(); - }); $timeline = Status::whereIn('profile_id', $following) ->whereNotIn('profile_id', $filtered) @@ -53,6 +49,7 @@ class SiteController extends Controller ->orderBy('created_at', 'desc') ->withCount(['comments', 'likes', 'shares']) ->simplePaginate(20); + $type = 'personal'; return view('timeline.template', compact('timeline', 'type')); From e7c4f084bc50d41155a5eed0d6a7ea8303c34db9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 19:00:21 -0700 Subject: [PATCH 3/9] Update TimelineController --- app/Http/Controllers/TimelineController.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php index 83ad70efb..5ce51eb89 100644 --- a/app/Http/Controllers/TimelineController.php +++ b/app/Http/Controllers/TimelineController.php @@ -27,14 +27,13 @@ class TimelineController extends Controller // $timeline = Timeline::build()->local(); $pid = Auth::user()->profile->id; - $filtered = Cache::rememberForever("user:filter:list:$pid", function() use($pid) { - return UserFilter::whereUserId($pid) - ->whereFilterableType('App\Profile') - ->whereIn('filter_type', ['mute', 'block']) - ->pluck('filterable_id')->toArray(); - }); - $private = Profile::whereIsPrivate(true)->pluck('id'); - $filtered = array_merge($private->toArray(), $filtered); + $private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id'); + $filters = UserFilter::whereUserId($pid) + ->whereFilterableType('App\Profile') + ->whereIn('filter_type', ['mute', 'block']) + ->pluck('filterable_id')->toArray(); + $filtered = array_merge($private->toArray(), $filters); + $timeline = Status::whereHas('media') ->whereNotIn('profile_id', $filtered) ->whereNull('in_reply_to_id') From f153a66701a0264b370b964a5db99cfedfd665e3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 19:43:31 -0700 Subject: [PATCH 4/9] Update InternalApiController --- app/Http/Controllers/InternalApiController.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 80c3c4484..9b1b3af4e 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -6,12 +6,14 @@ use Illuminate\Http\Request; use App\{ DirectMessage, Hashtag, + Follower, Like, Media, Notification, Profile, StatusHashtag, Status, + UserFilter, }; use Auth,Cache; use Carbon\Carbon; @@ -122,8 +124,16 @@ class InternalApiController extends Controller public function discover(Request $request) { $profile = Auth::user()->profile; - - $following = Cache::get('feature:discover:following:'.$profile->id, []); + $pid = $profile->id; + //$following = Cache::get('feature:discover:following:'.$profile->id, []); + $following = Follower::whereProfileId($pid)->pluck('following_id'); + + $filtered = UserFilter::whereUserId($pid) + ->whereFilterableType('App\Profile') + ->whereIn('filter_type', ['mute', 'block']) + ->pluck('filterable_id')->toArray(); + $following = array_merge($following->push($pid)->toArray(), $filtered); + $people = Profile::select('id', 'name', 'username') ->with('avatar') ->inRandomOrder() @@ -141,7 +151,6 @@ class InternalApiController extends Controller }) ->whereIsNsfw(false) ->whereVisibility('public') - ->where('profile_id', '<>', $profile->id) ->whereNotIn('profile_id', $following) ->withCount(['comments', 'likes']) ->orderBy('created_at', 'desc') From dfc71913f1459d5838bf5e3ba039aba41eeab6f6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 19:44:27 -0700 Subject: [PATCH 5/9] Update master layout --- resources/views/layouts/app.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 5e1ca8298..f461b3956 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -26,7 +26,7 @@ @stack('styles') - + @include('layouts.partial.nav')
@yield('content') From 1a3c9292560447d904d81f572b1066a6bd9da992 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 19 Nov 2018 19:45:27 -0700 Subject: [PATCH 6/9] Update PostComponent.vue --- .../assets/js/components/PostComponent.vue | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 8de6e0281..a1ba11b20 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -124,15 +124,29 @@
- +
@@ -155,13 +169,27 @@
+
@@ -215,7 +243,10 @@