From 2befff8fd1142c5f0508aa3efb0b15dfd2dba70d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Dec 2021 00:47:33 -0700 Subject: [PATCH 1/5] Update ComposeModal --- resources/assets/js/components/ComposeModal.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index 94a011936..ec074a93a 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -1259,7 +1259,11 @@ export default { axios.post('/api/compose/v0/publish', data) .then(res => { let data = res.data; - window.location.href = data; + if(location.pathname === '/i/web/compose') { + location.href = '/i/web/post/' + data.split('/').at(-1); + } else { + location.href = data; + } }).catch(err => { let msg = err.response.data.message ? err.response.data.message : 'An unexpected error occured.' swal('Oops, something went wrong!', msg, 'error'); From 65064a88325fdc33f6053e259af75823e18bcbb4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Dec 2021 00:51:24 -0700 Subject: [PATCH 2/5] Update DiscoverComponent --- resources/assets/js/components/DiscoverComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/components/DiscoverComponent.vue b/resources/assets/js/components/DiscoverComponent.vue index 4b94f970b..3f50bf0c2 100644 --- a/resources/assets/js/components/DiscoverComponent.vue +++ b/resources/assets/js/components/DiscoverComponent.vue @@ -178,7 +178,7 @@ if(!this.recommendedLoading) { return; } - axios.get('/api/pixelfed/v2/discover/posts') + axios.get('/api/v1/discover/posts') .then((res) => { this.posts = res.data.posts.filter(r => r != null); this.recommendedLoading = false; From 7d3214d37e2ea18baf5647dc913efc456597b2f3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Dec 2021 00:54:53 -0700 Subject: [PATCH 3/5] Update web routes --- routes/web.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/web.php b/routes/web.php index 951ffc993..f342cff24 100644 --- a/routes/web.php +++ b/routes/web.php @@ -208,6 +208,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('blocks', 'AccountController@accountBlocksV2'); Route::get('filters', 'AccountController@accountFiltersV2'); }); + + Route::get('discover/accounts/popular', 'Api\ApiV1Controller@discoverAccountsPopular'); }); Route::group(['prefix' => 'local'], function () { From 37dcc4ae1379120833b6642572b50c46f34890f0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Dec 2021 00:59:03 -0700 Subject: [PATCH 4/5] Update PublicApiController --- app/Http/Controllers/PublicApiController.php | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 07a6a6fa4..ff48d0149 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -106,7 +106,7 @@ class PublicApiController extends Controller return response()->json($res); } - public function statusState(Request $request, $username, int $postid) + public function statusState(Request $request, $username, $postid) { $profile = Profile::whereUsername($username)->whereNull('status')->firstOrFail(); $status = Status::whereProfileId($profile->id)->findOrFail($postid); @@ -294,6 +294,7 @@ class PublicApiController extends Controller 'local' ) ->where('id', $dir, $id) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) ->whereLocal(true) ->whereScope('public') @@ -306,8 +307,9 @@ class PublicApiController extends Controller return $status; }) ->filter(function($s) use($filtered) { - return in_array($s['account']['id'], $filtered) == false; - }); + return $s && in_array($s['account']['id'], $filtered) == false; + }) + ->values(); $res = $timeline->toArray(); } else { $timeline = Status::select( @@ -330,6 +332,7 @@ class PublicApiController extends Controller 'reblogs_count', 'updated_at' ) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) ->with('profile', 'hashtags', 'mentions') ->whereLocal(true) @@ -343,8 +346,9 @@ class PublicApiController extends Controller return $status; }) ->filter(function($s) use($filtered) { - return in_array($s['account']['id'], $filtered) == false; - }); + return $s && in_array($s['account']['id'], $filtered) == false; + }) + ->values(); $res = $timeline->toArray(); } @@ -538,15 +542,7 @@ class PublicApiController extends Controller $max = $request->input('max_id'); $limit = $request->input('limit') ?? 3; $user = $request->user(); - $amin = SnowflakeService::byDate(now()->subDays(90)); - - $key = 'user:last_active_at:id:'.$user->id; - $ttl = now()->addMinutes(5); - Cache::remember($key, $ttl, function() use($user) { - $user->last_active_at = now(); - $user->save(); - return; - }); + $amin = SnowflakeService::byDate(now()->subDays(490)); $filtered = $user ? UserFilterService::filters($user->profile_id) : []; @@ -561,6 +557,7 @@ class PublicApiController extends Controller 'created_at', ) ->where('id', $dir, $id) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) ->whereNotIn('profile_id', $filtered) ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) ->whereNotNull('uri') @@ -583,6 +580,7 @@ class PublicApiController extends Controller 'scope', 'created_at', ) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) ->whereNotIn('profile_id', $filtered) ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) ->whereNotNull('uri') From 4661dbadd1f256b9072297e5fab18a00b3be6878 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Dec 2021 00:59:53 -0700 Subject: [PATCH 5/5] Update compiled assets --- public/js/spa.js | Bin 1623813 -> 1624069 bytes public/mix-manifest.json | Bin 1983 -> 1983 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/js/spa.js b/public/js/spa.js index bff0e86e2c2c5d37352ec8a02867907d9456e516..73d18e90e9c5a0be814c97b81f521d0d25bb8ecf 100644 GIT binary patch delta 1325 zcmZ{keQXnT7{}B0+O_Mo_tM_ArA=*1W?H;;w{>eqv2hBFjF^d_VltX}Yp>g3)0Xzu ziA!<8U|ooNaiNd?VWcrJiVivj&zO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