Skip to content

Commit 51f9b63

Browse files
committed
Comment Mentions: Fixed and tweaks during review of changes
- Added advisory on role permission form to advise which allow listing of users/roles. - Updated database config to avoid PHP8.5 deprecation. - Tweaked migration to remove unused index. - Fixed test namespace.
1 parent 90fc02c commit 51f9b63

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

app/Config/database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
'strict' => false,
8282
'engine' => null,
8383
'options' => extension_loaded('pdo_mysql') ? array_filter([
84-
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
84+
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
8585
]) : [],
8686
],
8787

database/migrations/2025_12_15_140219_create_mention_history_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function up(): void
1515
$table->increments('id');
1616
$table->string('mentionable_type', 50)->index();
1717
$table->unsignedBigInteger('mentionable_id')->index();
18-
$table->unsignedInteger('from_user_id')->index();
18+
$table->unsignedInteger('from_user_id');
1919
$table->unsignedInteger('to_user_id');
2020
$table->timestamps();
2121
});

lang/en/settings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@
197197
'role_import_content' => 'Import content',
198198
'role_editor_change' => 'Change page editor',
199199
'role_notifications' => 'Receive & manage notifications',
200+
'role_permission_note_users_and_roles' => 'These permissions will technically also provide visibility & searching of users & roles in the system.',
200201
'role_asset' => 'Asset Permissions',
201202
'roles_system_warning' => 'Be aware that access to any of the above three permissions can allow a user to alter their own privileges or the privileges of others in the system. Only assign roles with these permissions to trusted users.',
202203
'role_asset_desc' => 'These permissions control default access to the assets within the system. Permissions on Books, Chapters and Pages will override these permissions.',
203204
'role_asset_admins' => 'Admins are automatically given access to all content but these options may show or hide UI options.',
204205
'role_asset_image_view_note' => 'This relates to visibility within the image manager. Actual access of uploaded image files will be dependant upon system image storage option.',
206+
'role_asset_users_note' => 'These permissions will technically also provide visibility & searching of users in the system.',
205207
'role_all' => 'All',
206208
'role_own' => 'Own',
207209
'role_controlled_by_asset' => 'Controlled by the asset they are uploaded to',

resources/views/settings/roles/parts/form.blade.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
<label class="setting-list-label">{{ trans('settings.role_system') }}</label>
3131
<a href="#" refs="permissions-table@toggle-all" class="text-small text-link">{{ trans('common.toggle_all') }}</a>
3232

33-
<div class="toggle-switch-list grid half mt-m">
33+
<div class="toggle-switch-list grid half my-m">
3434
<div>
35-
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-all', 'label' => trans('settings.role_manage_entity_permissions')])</div>
36-
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-own', 'label' => trans('settings.role_manage_own_entity_permissions')])</div>
35+
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-all', 'label' => trans('settings.role_manage_entity_permissions')]) <sup>1</sup></div>
36+
<div>@include('settings.roles.parts.checkbox', ['permission' => 'restrictions-manage-own', 'label' => trans('settings.role_manage_own_entity_permissions')]) <sup>1</sup></div>
3737
<div>@include('settings.roles.parts.checkbox', ['permission' => 'templates-manage', 'label' => trans('settings.role_manage_page_templates')])</div>
3838
<div>@include('settings.roles.parts.checkbox', ['permission' => 'access-api', 'label' => trans('settings.role_access_api')])</div>
3939
<div>@include('settings.roles.parts.checkbox', ['permission' => 'content-export', 'label' => trans('settings.role_export_content')])</div>
@@ -48,6 +48,10 @@
4848
<p class="text-warn text-small mt-s mb-none">{{ trans('settings.roles_system_warning') }}</p>
4949
</div>
5050
</div>
51+
52+
<p class="mb-none text-small text-muted">
53+
<sup>1</sup> {{ trans('settings.role_permission_note_users_and_roles') }}
54+
</p>
5155
</div>
5256

5357
<div>
@@ -75,14 +79,16 @@ class="item-list toggle-switch-list">
7579
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.books'), 'permissionPrefix' => 'book'])
7680
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.chapters'), 'permissionPrefix' => 'chapter'])
7781
@include('settings.roles.parts.asset-permissions-row', ['title' => trans('entities.pages'), 'permissionPrefix' => 'page'])
78-
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.images'), 'permissionPrefix' => 'image', 'refMark' => '1'])
82+
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.images'), 'permissionPrefix' => 'image'])
7983
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.attachments'), 'permissionPrefix' => 'attachment'])
8084
@include('settings.roles.parts.related-asset-permissions-row', ['title' => trans('entities.comments'), 'permissionPrefix' => 'comment'])
8185
</div>
8286

8387
<div>
8488
<p class="text-muted text-small p-m">
8589
<sup>1</sup> {{ trans('settings.role_asset_image_view_note') }}
90+
<br>
91+
<sup>2</sup> {{ trans('settings.role_asset_users_note') }}
8692
</p>
8793
</div>
8894
</div>

resources/views/settings/roles/parts/related-asset-permissions-row.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
<div class="flex py-s px-m min-width-xxs">
77
<small class="hide-over-m bold">{{ trans('common.create') }}<br></small>
88
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-create-all', 'label' => ''])
9+
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
910
</div>
1011
<div class="flex py-s px-m min-width-xxs">
1112
<small class="hide-over-m bold">{{ trans('common.view') }}<br></small>
12-
<small class="faded">{{ trans('settings.role_controlled_by_asset') }}@if($refMark ?? false)<sup>{{ $refMark }}</sup>@endif</small>
13+
<small class="faded">{{ trans('settings.role_controlled_by_asset') }}@if($permissionPrefix === 'image')<sup class="text-muted">1</sup>@endif</small>
1314
</div>
1415
<div class="flex py-s px-m min-width-xxs">
1516
<small class="hide-over-m bold">{{ trans('common.edit') }}<br></small>
1617
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-own', 'label' => trans('settings.role_own')])
18+
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
1719
<br>
1820
@include('settings.roles.parts.checkbox', ['permission' => $permissionPrefix . '-update-all', 'label' => trans('settings.role_all')])
21+
@if($permissionPrefix === 'comment')<sup class="text-muted">2</sup>@endif
1922
</div>
2023
<div class="flex py-s px-m min-width-xxs">
2124
<small class="hide-over-m bold">{{ trans('common.delete') }}<br></small>

tests/Activity/CommentDisplayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Activity;
3+
namespace Tests\Activity;
44

55
use BookStack\Activity\Models\Comment;
66
use Tests\TestCase;

0 commit comments

Comments
 (0)