From 75fbd373c86d313e76ffd5aa884733c2d0e63cb4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Aug 2022 20:32:17 -0600 Subject: [PATCH 1/5] Remove quilljs from admin page editor, fixes #3616 --- app/Http/Controllers/SiteController.php | 2 +- resources/views/admin/pages/edit.blade.php | 127 +++++++++++---------- resources/views/admin/pages/home.blade.php | 107 +++++++++-------- 3 files changed, 122 insertions(+), 114 deletions(-) diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 7202f7c6e..f4cac26be 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -80,7 +80,7 @@ class SiteController extends Controller { $page = Cache::remember('site:privacy', now()->addDays(120), function() { $slug = '/site/privacy'; - $page = Page::whereSlug($slug)->whereActive(true)->first(); + return Page::whereSlug($slug)->whereActive(true)->first(); }); return View::make('site.privacy')->with(compact('page'))->render(); } diff --git a/resources/views/admin/pages/edit.blade.php b/resources/views/admin/pages/edit.blade.php index de1a7feb8..5a3530e0d 100644 --- a/resources/views/admin/pages/edit.blade.php +++ b/resources/views/admin/pages/edit.blade.php @@ -1,27 +1,36 @@ -@extends('admin.partial.template') - -@include('admin.settings.sidebar') +@extends('admin.partial.template-full') @section('section') -
-

Edit Page

-

{{$page->slug}}

-
-
- -
+
+
+
+
+
+
+

Edit Page

+

{{$page->slug}}

+
+
+
+
+
+

Page URL: {{$page->url()}} {{-- Edit --}}

-
+
{!!$page->content!!}
+
+ + +
-
+
active?'checked="true"':''}}>
@@ -34,69 +43,69 @@
- +
@endsection @push('styles') - @endpush @push('scripts') - - -@endpush \ No newline at end of file +@endpush diff --git a/resources/views/admin/pages/home.blade.php b/resources/views/admin/pages/home.blade.php index cb315c27b..bab294647 100644 --- a/resources/views/admin/pages/home.blade.php +++ b/resources/views/admin/pages/home.blade.php @@ -1,11 +1,56 @@ @extends('admin.partial.template-full') @section('section') -
-

Pages

-

Set custom page content

-
-
+
+
+
+
+
+
+

Pages

+

Manage public and custom page content

+
+ + @if($pages->count() < 4) +
+
+
+ @if(!$pages->contains('slug', '=', '/site/about')) +
+ @csrf + + +
+ @endif + @if(!$pages->contains('slug', '=', '/site/privacy')) +
+ @csrf + + +
+ @endif + @if(!$pages->contains('slug', '=', '/site/terms')) +
+ @csrf + + +
+ @endif + @if(!$pages->contains('slug', '=', '/site/kb/community-guidelines')) +
+ @csrf + + +
+ @endif +
+
+ @endif +
+
+
+
+
@if($pages->count())
@@ -46,57 +91,11 @@
{{$pages->links()}}
-
-
-
- @csrf - - - -
- @csrf - - - -
- @csrf - - - -
- @csrf - - - -
- @else -
+ @else +
-

No custom pages found

+

No custom pages found

-
-
-
- @csrf - - - -
- @csrf - - - -
- @csrf - - - -
- @csrf - - - -
@endif @endsection From d1dbed8932756eb0a7963f1a3c466a283b75eea3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Aug 2022 20:35:52 -0600 Subject: [PATCH 2/5] Fix AdminStatService cache key, fixes #3612 --- app/Services/AdminStatsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/AdminStatsService.php b/app/Services/AdminStatsService.php index 2117207f3..9e345355a 100644 --- a/app/Services/AdminStatsService.php +++ b/app/Services/AdminStatsService.php @@ -113,7 +113,7 @@ class AdminStatsService protected static function additionalDataSummary() { $ttl = now()->addHours(24); - return Cache::remember('admin:dashboard:home:data:v0:24hr', $ttl, function() { + return Cache::remember('admin:dashboard:home:data-summary:v0:24hr', $ttl, function() { return [ 'statuses' => PrettyNumber::convert(Status::count()), 'profiles' => PrettyNumber::convert(Profile::count()), From c3e8a0e4391ae1cdacb38a02b86a5f63645ce93e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Aug 2022 21:45:30 -0600 Subject: [PATCH 3/5] Improve mute/block v1 api endpoints, fixes #3540 --- app/Http/Controllers/Api/ApiV1Controller.php | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 72f76f25d..68558a3c2 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -873,12 +873,15 @@ class ApiV1Controller extends Controller ->whereFilterableType('App\Profile') ->whereFilterType('block') ->simplePaginate($limit) - ->pluck('filterable_id'); + ->pluck('filterable_id') + ->map(function($id) { + return AccountService::get($id, true); + }) + ->filter(function($account) { + return $account && isset($account['id']); + }); - $profiles = Profile::findOrFail($blocked); - $resource = new Fractal\Resource\Collection($profiles, new AccountTransformer()); - $res = $this->fractal->createData($resource)->toArray(); - return $this->json($res); + return $this->json($blocked); } /** @@ -1725,19 +1728,21 @@ class ApiV1Controller extends Controller ]); $user = $request->user(); - $limit = $request->input('limit') ?? 40; + $limit = $request->input('limit', 40); $mutes = UserFilter::whereUserId($user->profile_id) ->whereFilterableType('App\Profile') ->whereFilterType('mute') ->simplePaginate($limit) - ->pluck('filterable_id'); + ->pluck('filterable_id') + ->map(function($id) { + return AccountService::get($id, true); + }) + ->filter(function($account) { + return $account && isset($account['id']); + }); - $accounts = Profile::find($mutes); - - $resource = new Fractal\Resource\Collection($accounts, new AccountTransformer()); - $res = $this->fractal->createData($resource)->toArray(); - return $this->json($res); + return $this->json($mutes); } /** From c18dcde38ffa6a7fe8fcdbd36ffdca9a6661017f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Aug 2022 22:29:07 -0600 Subject: [PATCH 4/5] Set Last-Modified header for atom feeds, fixes #2988 --- app/Http/Controllers/ProfileController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 147d95842..179db033d 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -118,8 +118,7 @@ class ProfileController extends Controller 'list' => $settings->show_profile_followers ] ]; - $ui = $request->has('ui') && $request->input('ui') == 'memory' ? 'profile.memory' : 'profile.show'; - return view($ui, compact('profile', 'settings')); + return view('profile.show', compact('profile', 'settings')); } } @@ -210,7 +209,7 @@ class ProfileController extends Controller ->whereProfileId($pid) ->whereVisibility('public') ->whereType('photo') - ->latest() + ->orderByDesc('id') ->take(10) ->get() ->map(function($status) { @@ -224,10 +223,14 @@ class ProfileController extends Controller }) ->values(); $permalink = config('app.url') . "/users/{$profile['username']}.atom"; + $headers = ['Content-Type' => 'application/atom+xml']; + if($items && $items->count()) { + $headers['Last-Modified'] = now()->parse($items->first()['created_at'])->toRfc7231String(); + } return response() ->view('atom.user', compact('profile', 'items', 'permalink')) - ->header('Content-Type', 'application/atom+xml'); + ->withHeaders($headers); } public function meRedirect() From a7a2fef1e5504f52861549517a96732471859f1e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 15 Aug 2022 22:29:27 -0600 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c155d4da..5d40ff6f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,10 @@ - Fix remote account post counts ([149cf9dc](https://github.com/pixelfed/pixelfed/commit/149cf9dc)) - Enforce blocks on incoming likes, shares, replies and follows on all endpoints ([1545e37c](https://github.com/pixelfed/pixelfed/commit/1545e37c)) - Fix unlisted post web redirect and api response ([6033d837](https://github.com/pixelfed/pixelfed/commit/6033d837)) +- Remove quilljs from admin page editor, fixes #3616 ([75fbd373](https://github.com/pixelfed/pixelfed/commit/75fbd373)) +- Fix AdminStatService cache key, fixes #3612 ([d1dbed89](https://github.com/pixelfed/pixelfed/commit/d1dbed89)) +- Improve mute/block v1 api endpoints, fixes #3540 ([c3e8a0e4](https://github.com/pixelfed/pixelfed/commit/c3e8a0e4)) +- Set Last-Modified header for atom feeds, fixes #2988 ([c18dcde3](https://github.com/pixelfed/pixelfed/commit/c18dcde3)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)