From 728f10d77889d6f59148388c0b1b721da1a65506 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 16 Jul 2021 01:20:21 -0600 Subject: [PATCH] Update Timeline.vue, improve followed hashtags --- app/Services/StatusHashtagService.php | 9 +- resources/assets/js/components/Timeline.vue | 111 +++----------------- 2 files changed, 20 insertions(+), 100 deletions(-) diff --git a/app/Services/StatusHashtagService.php b/app/Services/StatusHashtagService.php index 497fe864..6863c1d0 100644 --- a/app/Services/StatusHashtagService.php +++ b/app/Services/StatusHashtagService.php @@ -20,6 +20,9 @@ class StatusHashtagService { return []; } + $pid = request()->user() ? request()->user()->profile_id : false; + $filtered = $pid ? UserFilterService::filters($pid) : []; + return StatusHashtag::whereHashtagId($id) ->whereStatusVisibility('public') ->whereHas('media') @@ -30,10 +33,10 @@ class StatusHashtagService { ->map(function ($i, $k) use ($id) { return self::getStatus($i, $id); }) - ->filter(function ($i) { - return isset($i['status']) && !empty($i['status']); + ->filter(function ($i) use($filtered) { + return isset($i['status']) && !empty($i['status']) && !in_array($i['status']['account']['id'], $filtered); }) - ->all(); + ->values(); } public static function coldGet($id, $start = 0, $stop = 2000) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index fcfa244b..f926bff4 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -55,16 +55,21 @@ -
-
- -
#{{hashtagPostsName}}
- +
+
+
+
+ +
+
+

You follow this hashtag. Learn more

-
+
-
+ @@ -196,85 +192,6 @@ v-for="(status, index) in discover_feed" :key="`discover_feed-${index}-${status.id}`"> -
-
-
Suggestions For You
- -
-
-
-
-
-

- - avatar - -

-
-

- - {{rec.username}} - -

-

{{rec.message}}

-
-

- Follow -

-
-
-
-
-
- - - { if(res.data.tags.length > 3) { this.showHashtagPosts = true; - this.hashtagPosts = res.data.tags.splice(0,3); + this.hashtagPosts = res.data.tags.splice(0,9); } }) })