CB Gallery 4.0.0 + CB Activity 6.2.0 - all stream photos show "Something Went Wrong!" for regular users after upgrade
Hello,After upgrading CB Gallery 2.5.1 → 4.0.0 (build.2026.05.28.14.44.54.53cd15d60) and CB Activity 6.1.1 → 6.2.0 (build.2026.04.16.16.44.21.f05970673), every photo attached to activity stream posts is replaced with the "Something Went Wrong!" message. The profile Gallery tab also shows "No media to display." for existing photos. Importantly:
as a Super User / global moderator everything displays fine — only regular users are affected, so the issue is easy to miss when testing as admin.Environment: Joomla 5.4.6, PHP 8.4.18, MariaDB 10.6.24, CB 2.11.0, CB Privacy 7.0.5 (we tested with it both published and unpublished — no difference).I spent some time debugging this and I believe there are two separate problems:
- Migration assigns legacy stream photos to the wrong gallery. Note we migrated from CB Gallery 2.5.1, so the data went through the full migration chain from the oldest supported version. Before the upgrade our stream photos had assets like profile.436.uploads and were referenced from params.gallery of activity rows. After the migration the items got asset = activity.ACTIVITY_ID (correct) but gallery_id = 1 (Profile Gallery) instead of 50 (CB Activity - Activity). Distribution after upgrade: 1051 items with asset activity.% and 83 with comment.% all ended up in gallery 1, while 2 comment photos uploaded after the upgrade correctly got gallery 51. The cbactivity_activity step in install.cbgallery.php sets both columns in one UPDATE (WHERE ... AND gallery_id = 0]), so it looks like the items already had a non-zero gallery_id when that step ran, or the step ran twice/partially.
- Even with the correct gallery_id the photos are still denied for non-moderators. I manually set one item to gallery_id = 50and it still rendered as "Something Went Wrong!". Following the code: the stream template calls GalleryHelper::getMedia() → QueryHelper::verifyAccess() → QueryHelper::canAccess(), which calls $row->getGallery()->canAccess('any'). ItemTable::getGallery() seeds the gallery data from ItemTable::getAsset(), whose data array only contains gallery_id, media_type, media_id, user_id, is_hold — there is no activity_id. So the system gallery's asset template activity.[activity_id] never gets its placeholder substituted, and AssetEntity::canAccess() starts with if ( strpos( $this->asset, ') and 51, so effectively every gallery item in streams is hidden from regular users.
For now I restored the site from backup (CB Gallery 2.5.1 / CB Activity 6.1.1) and everything works again, so this is not urgent for me, but I'd like to redo the upgrade once it's safe. Could you:
- confirm whether the stream rendering path is supposed to pass the activity context to the gallery asset (or whether AssetEntity::canAccess()should not hard-fail on unresolved placeholders for system galleries), and
- take a look at the migration mapping for legacy activity/comment photos (gallery_id 1 vs 50/51)?