From 717f17cdee57bd246c97aed3c639cfb9ffd63ac0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 15 Mar 2025 00:20:03 -0600 Subject: [PATCH 1/2] Update DM config, allow new users to send DMs by default, with a new env variable to enforce a 72h limit --- app/Http/Controllers/DirectMessageController.php | 4 +++- config/instance.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DirectMessageController.php b/app/Http/Controllers/DirectMessageController.php index b6d14692c..1e3a5cefc 100644 --- a/app/Http/Controllers/DirectMessageController.php +++ b/app/Http/Controllers/DirectMessageController.php @@ -144,7 +144,9 @@ class DirectMessageController extends Controller $user = $request->user(); abort_if($user->has_roles && ! UserRoleService::can('can-direct-message', $user->id), 403, 'Invalid permissions for this action'); if (! $user->is_admin) { - abort_if($user->created_at->gt(now()->subHours(72)), 400, 'You need to wait a bit before you can DM another account'); + if ((bool) ! config_cache('instance.allow_new_account_dms')) { + abort_if($user->created_at->gt(now()->subHours(72)), 400, 'You need to wait a bit before you can DM another account'); + } } $profile = $user->profile; $recipient = Profile::where('id', '!=', $profile->id)->findOrFail($request->input('to_id')); diff --git a/config/instance.php b/config/instance.php index 18d887873..72961e5a0 100644 --- a/config/instance.php +++ b/config/instance.php @@ -186,4 +186,6 @@ return [ ], 'show_peers' => env('INSTANCE_SHOW_PEERS', false), + + 'allow_new_account_dms' => env('INSTANCE_ALLOW_NEW_DMS', true), ]; From 5c4d54ed1b90ca33803e40d987279f68a4881558 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 15 Mar 2025 00:21:11 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6052dae00..4a83b16bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ - Update AccountPostCountStatUpdate, fix memory leak ([134eb6324](https://github.com/pixelfed/pixelfed/commit/134eb6324)) - Update snowflake config, allow custom datacenter/worker ids ([806e210f1](https://github.com/pixelfed/pixelfed/commit/806e210f1)) - Update ApiV1Controller, return empty statuses feed for private accounts instead of 403 response ([cce657d9c](https://github.com/pixelfed/pixelfed/commit/cce657d9c)) +- Update DM config, allow new users to send DMs by default, with a new env variable to enforce a 72h limit ([717f17cde](https://github.com/pixelfed/pixelfed/commit/717f17cde)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)