diff --git a/src/interfaces/api/handlers/grant_handler.rs b/src/interfaces/api/handlers/grant_handler.rs index 77ab00ee..bdd49756 100644 --- a/src/interfaces/api/handlers/grant_handler.rs +++ b/src/interfaces/api/handlers/grant_handler.rs @@ -676,12 +676,13 @@ pub async fn list_my_shares( file_idx += 1; match result { Ok(file_dto) => { + // Caller is the granter — they had share-access to the + // resource, so the containing hierarchy is already known + // to them. Keep `path` (unlike list_shared_with_me). items.push(OutgoingResourceItemDto { resource_type: ResourceTypeDto::File, first_shared_at: summary.first_shared_at, - resource: ResourceContentDto::File( - file_dto.clone().without_hierarchy_info(), - ), + resource: ResourceContentDto::File(file_dto.clone()), grants, }); } @@ -708,9 +709,7 @@ pub async fn list_my_shares( items.push(OutgoingResourceItemDto { resource_type: ResourceTypeDto::Folder, first_shared_at: summary.first_shared_at, - resource: ResourceContentDto::Folder( - folder_dto.clone().without_hierarchy_info(), - ), + resource: ResourceContentDto::Folder(folder_dto.clone()), grants, }); } diff --git a/static/js/components/mySharesList.js b/static/js/components/mySharesList.js index 5c04e202..9dcaadc4 100644 --- a/static/js/components/mySharesList.js +++ b/static/js/components/mySharesList.js @@ -167,6 +167,8 @@ class MySharesList { _buildResourceLaneHeader(item) { const row = document.createElement('div'); row.className = 'ms-resource-row'; + if (item.resource.path) row.dataset.path = item.resource.path; + if (item.resource.owner_id) row.dataset.ownerId = item.resource.owner_id; row.appendChild(buildResourceIcon(item.resource, item.resource_type)); @@ -229,6 +231,13 @@ class MySharesList { if (_expiryState(grant.expires_at ?? null) === 'expired') { row.classList.add('ms-grant-row--expired'); } + // In sharedWith mode each grant row represents a (resource → subject) + // pair, so stamp the resource hierarchy info for the hover tooltip. + // In items mode the row represents a subject — no resource attrs. + if (viewMode === 'sharedWith') { + if (item.resource.path) row.dataset.path = item.resource.path; + if (item.resource.owner_id) row.dataset.ownerId = item.resource.owner_id; + } row.appendChild(this._buildIdentity(grant, item, viewMode)); row.appendChild(this._buildRolePill(grant.role)); diff --git a/static/js/features/itemTooltip.js b/static/js/features/itemTooltip.js index 78318fa1..8dd3e6ff 100644 --- a/static/js/features/itemTooltip.js +++ b/static/js/features/itemTooltip.js @@ -142,7 +142,7 @@ const _registry = new WeakMap(); /** Containers known to expose `data-path`/`data-owner-id` for tooltip use. * Add new opt-in row classes here when other views want the tooltip — each * one must stamp the dataset attributes itself. */ -const _TOOLTIP_SELECTOR = '.file-item, .ms-resource-row'; +const _TOOLTIP_SELECTOR = '.file-item, .ms-resource-row, .ms-grant-row'; /** * Attach tooltip listeners to every tooltip-capable row inside `container`.