Browse Source

Merge pull request #5862 from pixelfed/staging

Update DM config, allow new users to send DMs by default, with a new …
daniel 3 tháng trước cách đây
mục cha
commit
d05f0e1c99
3 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 1 0
      CHANGELOG.md
  2. 3 1
      app/Http/Controllers/DirectMessageController.php
  3. 2 0
      config/instance.php

+ 1 - 0
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)

+ 3 - 1
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'));

+ 2 - 0
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),
 ];