fix(MyShares): show tooltip when mouse over an item + fix the path

This commit is contained in:
Edouard Vanbelle
2026-05-30 10:41:16 +02:00
parent 3bcb3a5b3f
commit ae82f4b664
3 changed files with 15 additions and 7 deletions
+5 -6
View File
@@ -676,12 +676,13 @@ pub async fn list_my_shares(
file_idx += 1; file_idx += 1;
match result { match result {
Ok(file_dto) => { 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 { items.push(OutgoingResourceItemDto {
resource_type: ResourceTypeDto::File, resource_type: ResourceTypeDto::File,
first_shared_at: summary.first_shared_at, first_shared_at: summary.first_shared_at,
resource: ResourceContentDto::File( resource: ResourceContentDto::File(file_dto.clone()),
file_dto.clone().without_hierarchy_info(),
),
grants, grants,
}); });
} }
@@ -708,9 +709,7 @@ pub async fn list_my_shares(
items.push(OutgoingResourceItemDto { items.push(OutgoingResourceItemDto {
resource_type: ResourceTypeDto::Folder, resource_type: ResourceTypeDto::Folder,
first_shared_at: summary.first_shared_at, first_shared_at: summary.first_shared_at,
resource: ResourceContentDto::Folder( resource: ResourceContentDto::Folder(folder_dto.clone()),
folder_dto.clone().without_hierarchy_info(),
),
grants, grants,
}); });
} }
+9
View File
@@ -167,6 +167,8 @@ class MySharesList {
_buildResourceLaneHeader(item) { _buildResourceLaneHeader(item) {
const row = document.createElement('div'); const row = document.createElement('div');
row.className = 'ms-resource-row'; 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)); row.appendChild(buildResourceIcon(item.resource, item.resource_type));
@@ -229,6 +231,13 @@ class MySharesList {
if (_expiryState(grant.expires_at ?? null) === 'expired') { if (_expiryState(grant.expires_at ?? null) === 'expired') {
row.classList.add('ms-grant-row--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._buildIdentity(grant, item, viewMode));
row.appendChild(this._buildRolePill(grant.role)); row.appendChild(this._buildRolePill(grant.role));
+1 -1
View File
@@ -142,7 +142,7 @@ const _registry = new WeakMap();
/** Containers known to expose `data-path`/`data-owner-id` for tooltip use. /** 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 * Add new opt-in row classes here when other views want the tooltip — each
* one must stamp the dataset attributes itself. */ * 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`. * Attach tooltip listeners to every tooltip-capable row inside `container`.