1
0
Эх сурвалжийг харах

Merge pull request #2919 from pixelfed/staging

v0.11.1
daniel 3 жил өмнө
parent
commit
1f1c5da1f5

+ 5 - 1
CHANGELOG.md

@@ -1,6 +1,8 @@
 # Release Notes
 
-## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.0...dev)
+## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.1...dev)
+
+## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)
 ### Added
 - WebP Support ([069a0e4a](https://github.com/pixelfed/pixelfed/commit/069a0e4a))
 - Auto Following support for admins ([68aa2540](https://github.com/pixelfed/pixelfed/commit/68aa2540))
@@ -11,6 +13,7 @@
 - Federate Media Licenses ([14a1367a](https://github.com/pixelfed/pixelfed/commit/14a1367a))
 - Archive Posts ([e9ef0c88](https://github.com/pixelfed/pixelfed/commit/e9ef0c88))
 - Polls ([77092200](https://github.com/pixelfed/pixelfed/commit/77092200))
+- Federated Stories (#2895)
 
 ### Updated
 - Updated PrettyNumber, fix deprecated warning. ([20ec870b](https://github.com/pixelfed/pixelfed/commit/20ec870b))
@@ -108,6 +111,7 @@
 - Updated Profile, fix following count bug. ([ee9f0795](https://github.com/pixelfed/pixelfed/commit/ee9f0795))
 - Updated DirectMessageController, fix autocomplete bug. ([0f00be4d](https://github.com/pixelfed/pixelfed/commit/0f00be4d))
 - Updated StoryService, fix division by zero bug. ([6ae1ba0a](https://github.com/pixelfed/pixelfed/commit/6ae1ba0a))
+- Updated ApiV1Controller, fix empty public timeline bug. ([0584f9ee](https://github.com/pixelfed/pixelfed/commit/0584f9ee))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0)

+ 5 - 3
app/Http/Controllers/Api/ApiV1Controller.php

@@ -1486,9 +1486,11 @@ class ApiV1Controller extends Controller
 		$limit = $request->input('limit') ?? 3;
 		$user = $request->user();
 
-		if(PublicTimelineService::count() == 0) {
-        	PublicTimelineService::warmCache(true, 400);
-        }
+		Cache::remember('api:v1:timelines:public:cache_check', 3600, function() {
+			if(PublicTimelineService::count() == 0) {
+	        	PublicTimelineService::warmCache(true, 400);
+	        }
+		});
 
         if ($max) {
 			$feed = PublicTimelineService::getRankedMaxId($max, $limit);

+ 22 - 7
app/Http/Controllers/StoryController.php

@@ -36,13 +36,28 @@ class StoryController extends StoryComposeController
 		abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
 		$pid = $request->user()->profile_id;
 
-		$s = Story::select('stories.*', 'followers.following_id')
-			->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
-			->where('followers.profile_id', $pid)
-			->where('stories.active', true)
-			->groupBy('followers.following_id')
-			->orderByDesc('id')
-			->get();
+		if(config('database.default') == 'pgsql') {
+			$s = Story::select('stories.*', 'followers.following_id')
+				->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
+				->where('followers.profile_id', $pid)
+				->where('stories.active', true)
+				->get()
+				->map(function($s) {
+					$r  = new \StdClass;
+					$r->id = $s->id;
+					$r->profile_id = $s->profile_id;
+					return $r;
+				})
+				->unique('profile_id');
+		} else {
+			$s = Story::select('stories.*', 'followers.following_id')
+				->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
+				->where('followers.profile_id', $pid)
+				->where('stories.active', true)
+				->groupBy('followers.following_id')
+				->orderByDesc('id')
+				->get();
+		}
 
 		$res = $s->map(function($s) use($pid) {
 			$profile = AccountService::get($s->profile_id);

+ 2 - 2
app/Profile.php

@@ -65,7 +65,7 @@ class Profile extends Model
 
 	public function followingCount($short = false)
 	{
-		$count = Cache::remember('profile:following_count:v1:'.$this->id, now()->addMonths(1), function() {
+		$count = Cache::remember('profile:following_count:'.$this->id, now()->addMonths(1), function() {
 			if($this->domain == null && $this->user->settings->show_profile_following_count == false) {
 				return 0;
 			}
@@ -82,7 +82,7 @@ class Profile extends Model
 
 	public function followerCount($short = false)
 	{
-		$count = Cache::remember('profile:follower_count:v1:'.$this->id, now()->addMonths(1), function() {
+		$count = Cache::remember('profile:follower_count:'.$this->id, now()->addMonths(1), function() {
 			if($this->domain == null && $this->user->settings->show_profile_follower_count == false) {
 				return 0;
 			}

+ 4 - 4
app/Services/PublicTimelineService.php

@@ -48,10 +48,10 @@ class PublicTimelineService {
 
 	public static function add($val)
 	{
-		return;
-
-		if(config('database.redis.client') === 'phpredis' && self::count() > 400) {
-			Redis::zpopmin(self::CACHE_KEY);
+		if(self::count() > 400) {
+			if(config('database.redis.client') === 'phpredis') {
+				Redis::zpopmin(self::CACHE_KEY);
+			}
 		}
 
 		return Redis::zadd(self::CACHE_KEY, $val, $val);

+ 1 - 1
config/pixelfed.php

@@ -23,7 +23,7 @@ return [
 	| This value is the version of your Pixelfed instance.
 	|
 	*/
-	'version' => '0.11.0',
+	'version' => '0.11.1',
 
 	/*
 	|--------------------------------------------------------------------------

BIN
public/js/stories.js


BIN
public/mix-manifest.json