| @@ -537,13 +537,14 @@ | ||
| 537 | 537 | $args = (array) apply_filters( 'openstation_files_query_args', $args, $user_id, $parent_id ); |
| 538 | 538 | |
| 539 | 539 | // Active queries always exclude trashed rows. Recycle-bin |
| 540 | 540 | // callers reach for the dedicated trash store. |
| 541 | - if ( ! empty( $args['share_view'] ) ) { | |
| 542 | - // Shared sub-folder — return every placement in the folder | |
| 543 | - // regardless of which user originally placed it. The icons | |
| 544 | - // are part of the folder; the owner_id column is audit info, | |
| 545 | - // not a permission gate. | |
| 541 | + if ( ! empty( $args['share_view'] ) || (int) $args['parent_id'] > 0 ) { | |
| 542 | + // A sub-folder, the viewer's own or shared with them: return | |
| 543 | + // every placement in it regardless of which user placed it, | |
| 544 | + // so the owner of a shared folder sees what a writer added. | |
| 545 | + // The icons are part of the folder; the owner_id column is | |
| 546 | + // audit info, not a permission gate. | |
| 546 | 547 | $rows = $wpdb->get_results( |
| 547 | 548 | $wpdb->prepare( |
| 548 | 549 | "SELECT * FROM {$tables['placements']} |
| 549 | 550 | WHERE parent_id = %d |
| @@ -574,11 +575,11 @@ | ||
| 574 | 575 | foreach ( $rows as $row ) { |
| 575 | 576 | $normalized = openstation_files_normalize_placement_row( $row ); |
| 576 | 577 | $file = openstation_resolve_file( $normalized['file_type'], $normalized['file_ref'] ); |
| 577 | 578 | if ( empty( $args['share_view'] ) ) { |
| 578 | - // Private folder / desktop root — keep the existing | |
| 579 | - // per-row read filter so stale/inaccessible entities | |
| 580 | - // don't clutter the user's own view. | |
| 579 | + // The viewer's own folder or desktop root: keep the | |
| 580 | + // per-row read filter so stale or inaccessible entities, | |
| 581 | + // a writer's included, don't clutter the user's own view. | |
| 581 | 582 | if ( $file && ! $file->can_read( $user_id ) ) { |
| 582 | 583 | continue; |
| 583 | 584 | } |
| 584 | 585 | } elseif ( $file && ! $file->can_read( $user_id ) ) { |