Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to `:package_name` will be documented in this file.

## v1.3.6 - 2026-07-13

### What's Changed

* Fix `sharing.show_nested_shared_in_library` so it also gates root-level shared items in the main Library view (classic default `false` restores pre-v1.3.4 behavior)

**Full Changelog**: https://github.com/TappNetwork/Filament-Library/compare/v1.3.5...v1.3.6

## v1.3.5 - 2026-07-10

### What's Changed
Expand Down
6 changes: 3 additions & 3 deletions config/filament-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
'shared_with_me' => env('FILAMENT_LIBRARY_SHARED_WITH_ME', true),

/*
| When true, nested (non-root) items with explicit per-user permissions
| also appear in the main Library view. Root-level shared items already
| appear there regardless of this setting.
| When true, items with explicit per-user permissions appear in the main
| Library view (root-level shared folders/files and nested shared items).
| When false, those items only appear on the Shared with Me page.
*/
'show_nested_shared_in_library' => env('FILAMENT_LIBRARY_SHOW_NESTED_SHARED', false),
],
Expand Down
17 changes: 10 additions & 7 deletions src/Resources/Pages/ListLibraryItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,31 @@ protected function getTableQuery(): Builder
$query->where('parent_id', $this->parentId);
} else {
$user = auth()->user();
$showNestedShared = (bool) config('filament-library.sharing.show_nested_shared_in_library', false);
$showSharedInLibrary = (bool) config('filament-library.sharing.show_nested_shared_in_library', false);

$query->where(function (Builder $visibility) use ($user, $showNestedShared): void {
$visibility->where(function (Builder $root) use ($user): void {
$query->where(function (Builder $visibility) use ($user, $showSharedInLibrary): void {
$visibility->where(function (Builder $root) use ($user, $showSharedInLibrary): void {
$root->whereNull('parent_id')
->where(function (Builder $access) use ($user): void {
->where(function (Builder $access) use ($user, $showSharedInLibrary): void {
$access->where('general_access', 'anyone_can_view');

if ($user && FilamentLibraryPlugin::isLibraryAdmin($user)) {
$access->orWhereIn('general_access', ['private', 'inherit']);
}

if ($user) {
$access->orWhere('created_by', $user->id)
->orWhereHas('permissions', function (Builder $permissions) use ($user): void {
$access->orWhere('created_by', $user->id);

if ($showSharedInLibrary) {
$access->orWhereHas('permissions', function (Builder $permissions) use ($user): void {
$permissions->where('user_id', $user->id);
});
}
}
});
});

if ($user && $showNestedShared) {
if ($user && $showSharedInLibrary) {
$visibility->orWhere(function (Builder $sharedNested) use ($user): void {
$sharedNested->whereNotNull('parent_id')
->whereHas('permissions', function (Builder $permissions) use ($user): void {
Expand Down