소스 검색

Merge pull request #3349 from pixelfed/staging

Staging
daniel 3 년 전
부모
커밋
19e8d596f4
4개의 변경된 파일12개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 1
      app/Http/Controllers/DiscoverController.php
  2. 2 2
      app/Models/CustomEmoji.php
  3. 1 1
      app/Services/CustomEmojiService.php
  4. 4 2
      app/Services/StatusHashtagService.php

+ 5 - 1
app/Http/Controllers/DiscoverController.php

@@ -96,8 +96,12 @@ class DiscoverController extends Controller
 				})
 				})
 				->values();
 				->values();
 		} else {
 		} else {
+			if($page != 1) {
+				$res['tags'] = [];
+				return $res;
+			}
 			$key = 'discover:tags:public_feed:' . $hashtag->id . ':page:' . $page;
 			$key = 'discover:tags:public_feed:' . $hashtag->id . ':page:' . $page;
-			$tags = Cache::remember($key, 900, function() use($hashtag, $page, $end) {
+			$tags = Cache::remember($key, 43200, function() use($hashtag, $page, $end) {
 				return collect(StatusHashtagService::get($hashtag->id, $page, $end))
 				return collect(StatusHashtagService::get($hashtag->id, $page, $end))
 					->filter(function($tag) {
 					->filter(function($tag) {
 						if(!$tag['status']['local']) {
 						if(!$tag['status']['local']) {

+ 2 - 2
app/Models/CustomEmoji.php

@@ -47,7 +47,7 @@ class CustomEmoji extends Model
 					return [
 					return [
 						'shortcode' => $match,
 						'shortcode' => $match,
 						'url' => $url,
 						'url' => $url,
-						'static_path' => $url,
+						'static_url' => $url,
 						'visible_in_picker' => $tag->disabled == false
 						'visible_in_picker' => $tag->disabled == false
 					];
 					];
 				}
 				}
@@ -57,7 +57,7 @@ class CustomEmoji extends Model
 			if($activitypub == true) {
 			if($activitypub == true) {
 				return $tag && isset($tag['icon']);
 				return $tag && isset($tag['icon']);
 			} else {
 			} else {
-				return $tag && isset($tag['static_path']);
+				return $tag && isset($tag['static_url']);
 			}
 			}
 		})
 		})
 		->values()
 		->values()

+ 1 - 1
app/Services/CustomEmojiService.php

@@ -118,7 +118,7 @@ class CustomEmojiService
 					return [
 					return [
 						'shortcode' => str_replace(':', '', $emojo->shortcode),
 						'shortcode' => str_replace(':', '', $emojo->shortcode),
 						'url' => $url,
 						'url' => $url,
-						'static_path' => $url,
+						'static_url' => $url,
 						'visible_in_picker' => $emojo->disabled == false
 						'visible_in_picker' => $emojo->disabled == false
 					];
 					];
 				})
 				})

+ 4 - 2
app/Services/StatusHashtagService.php

@@ -26,7 +26,6 @@ class StatusHashtagService {
 
 
 		return StatusHashtag::whereHashtagId($id)
 		return StatusHashtag::whereHashtagId($id)
 			->whereStatusVisibility('public')
 			->whereStatusVisibility('public')
-			->whereHas('media')
 			->skip($stop)
 			->skip($stop)
 			->latest()
 			->latest()
 			->take(9)
 			->take(9)
@@ -35,7 +34,10 @@ class StatusHashtagService {
 				return self::getStatus($i, $id);
 				return self::getStatus($i, $id);
 			})
 			})
 			->filter(function ($i) use($filtered) {
 			->filter(function ($i) use($filtered) {
-				return isset($i['status']) && !empty($i['status']) && !in_array($i['status']['account']['id'], $filtered);
+				return isset($i['status']) &&
+				!empty($i['status']) && !in_array($i['status']['account']['id'], $filtered) &&
+				isset($i['status']['media_attachments']) &&
+				!empty($i['status']['media_attachments']);
 			})
 			})
 			->values();
 			->values();
 	}
 	}