From 3880ab2230cdcc56496e9762eb9500653b276c7d Mon Sep 17 00:00:00 2001 From: Samuel Roland <47849646+samuelroland@users.noreply.github.com> Date: Sat, 4 Dec 2021 02:15:29 +0100 Subject: [PATCH 1/5] Remove remoteRedirect() for profile website --- resources/assets/js/components/Profile.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 187ac9ad5..7fe5ba75f 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -145,7 +145,7 @@ {{profile.pronouns.join('/')}}

-

{{formatWebsite(profile.website)}}

+

{{formatWebsite(profile.website)}}

Admin From e5387d6742d3d023f6875ce31faaca0da0cf78cb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 Dec 2021 20:47:00 -0700 Subject: [PATCH 2/5] Add StatusMentionService, fixes #3026 --- app/Services/StatusMentionService.php | 23 +++++++++++++++++++ .../Api/StatusStatelessTransformer.php | 5 ++-- app/Transformer/Api/StatusTransformer.php | 5 ++-- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 app/Services/StatusMentionService.php diff --git a/app/Services/StatusMentionService.php b/app/Services/StatusMentionService.php new file mode 100644 index 000000000..6b27149c9 --- /dev/null +++ b/app/Services/StatusMentionService.php @@ -0,0 +1,23 @@ +get() + ->map(function($mention) { + return AccountService::get($mention->profile_id); + })->filter(function($mention) { + return $mention; + }) + ->values() + ->toArray(); + } +} diff --git a/app/Transformer/Api/StatusStatelessTransformer.php b/app/Transformer/Api/StatusStatelessTransformer.php index 5dbca96b2..91ed1484b 100644 --- a/app/Transformer/Api/StatusStatelessTransformer.php +++ b/app/Transformer/Api/StatusStatelessTransformer.php @@ -11,6 +11,7 @@ use App\Services\MediaService; use App\Services\MediaTagService; use App\Services\StatusHashtagService; use App\Services\StatusLabelService; +use App\Services\StatusMentionService; use App\Services\ProfileService; use App\Services\PollService; @@ -35,7 +36,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract 'created_at' => $status->created_at->format('c'), 'emojis' => [], 'reblogs_count' => 0, - 'favourites_count' => 0, + 'favourites_count' => $status->likes_count ?? 0, 'reblogged' => null, 'favourited' => null, 'muted' => null, @@ -48,7 +49,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract ], 'language' => null, 'pinned' => null, - 'mentions' => [], + 'mentions' => StatusMentionService::get($status->id), 'tags' => [], 'pf_type' => $status->type ?? $status->setType(), 'reply_count' => (int) $status->reply_count, diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php index 1aca5398d..1ac8a700b 100644 --- a/app/Transformer/Api/StatusTransformer.php +++ b/app/Transformer/Api/StatusTransformer.php @@ -12,6 +12,7 @@ use App\Services\MediaService; use App\Services\MediaTagService; use App\Services\StatusHashtagService; use App\Services\StatusLabelService; +use App\Services\StatusMentionService; use App\Services\ProfileService; use Illuminate\Support\Str; use App\Services\PollService; @@ -37,7 +38,7 @@ class StatusTransformer extends Fractal\TransformerAbstract 'created_at' => $status->created_at->format('c'), 'emojis' => [], 'reblogs_count' => 0, - 'favourites_count' => 0, + 'favourites_count' => $status->likes_count ?? 0, 'reblogged' => $status->shared(), 'favourited' => $status->liked(), 'muted' => null, @@ -50,7 +51,7 @@ class StatusTransformer extends Fractal\TransformerAbstract ], 'language' => null, 'pinned' => null, - 'mentions' => [], + 'mentions' => StatusMentionService::get($status->id), 'tags' => [], 'pf_type' => $status->type ?? $status->setType(), 'reply_count' => (int) $status->reply_count, From 78b2650f3aa6bd634258bd43dc5aa2884bbbde90 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 Dec 2021 20:48:45 -0700 Subject: [PATCH 3/5] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 710ffbb79..0b6c1a5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added - Manual email verification requests. ([bc659387](https://github.com/pixelfed/pixelfed/commit/bc659387)) +- Added StatusMentionService, fixes #3026. ([e5387d67](https://github.com/pixelfed/pixelfed/commit/e5387d67)) ### Updated - Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3)) From b8e9056ee3fb98439284ed916b782c6d8c9d8f12 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Dec 2021 15:30:08 -0700 Subject: [PATCH 4/5] Update UserInviteController, fixes #3017 --- app/Http/Controllers/UserInviteController.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/UserInviteController.php b/app/Http/Controllers/UserInviteController.php index c9f83301f..9a8272820 100644 --- a/app/Http/Controllers/UserInviteController.php +++ b/app/Http/Controllers/UserInviteController.php @@ -9,19 +9,16 @@ use Illuminate\Support\Str; class UserInviteController extends Controller { - public function __construct() - { - abort_if(!config('pixelfed.user_invites.enabled'), 404); - } - public function create(Request $request) { + abort_if(!config('pixelfed.user_invites.enabled'), 404); abort_unless(Auth::check(), 403); return view('settings.invites.create'); } public function show(Request $request) { + abort_if(!config('pixelfed.user_invites.enabled'), 404); abort_unless(Auth::check(), 403); $invites = UserInvite::whereUserId(Auth::id())->paginate(10); $limit = config('pixelfed.user_invites.limit.total'); @@ -31,6 +28,7 @@ class UserInviteController extends Controller public function store(Request $request) { + abort_if(!config('pixelfed.user_invites.enabled'), 404); abort_unless(Auth::check(), 403); $this->validate($request, [ 'email' => 'required|email|unique:users|unique:user_invites', From c4d3851afe6dfed7dab5f67911487799b599f3f8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Dec 2021 15:31:09 -0700 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b6c1a5ee..26b96459d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - Updated PublicApiController, fix private account statuses api. Closes #2995. ([aa2dd26c](https://github.com/pixelfed/pixelfed/commit/aa2dd26c)) - Updated Status model, use AccountService to generate urls instead of loading profile relation. ([2ae527c0](https://github.com/pixelfed/pixelfed/commit/2ae527c0)) - Updated Autospam service, add mark all as read and mark all as not spam options and filter active, spam and not spam reports. ([ae8c7517](https://github.com/pixelfed/pixelfed/commit/ae8c7517)) +- Updated UserInviteController, fixes #3017. ([b8e9056e](https://github.com/pixelfed/pixelfed/commit/b8e9056e)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)