fix(shares): fix outgoing shares when browsing in files, fix shareBadge action to open shareDialog

This commit is contained in:
Edouard Vanbelle
2026-05-29 14:06:28 +02:00
parent eef67973b3
commit 615657a7be
4 changed files with 53 additions and 9 deletions
+16 -1
View File
@@ -15,6 +15,7 @@
*/
import { ResourceListComponent } from '../components/resourceList.js';
import { shareModal } from '../components/shareModal.js';
import { normalizeDateBucket, sizeBucket } from '../core/formatters.js';
import { i18n } from '../core/i18n.js';
import * as viewPrefs from '../core/viewPrefs.js';
@@ -218,6 +219,12 @@ function _ensureComponent() {
_component?.setFavoriteVisualState(item.id, type, true);
}
},
onShareBadgeClick: (item) => {
const isFile = 'mime_type' in item;
shareModal.open(item, isFile ? 'file' : 'folder', () => {
grants.fetchOutgoingGrants().then(() => refreshSharedBadges());
});
},
onContextMenu: (item, e) => ui.showContextMenuForItem(item, e),
onSelectionChange: (selectedItems) => {
batchToolbar._selected.clear();
@@ -454,4 +461,12 @@ async function loadFiles(options = { insertHistory: true }) {
}
}
export { addItem, filesView, loadFiles };
/**
* Re-evaluate the shared badge for every item currently rendered in the Files list.
* Call this after the outgoing grants cache has been refreshed.
*/
function refreshSharedBadges() {
_component?.refreshSharedBadges();
}
export { addItem, filesView, loadFiles, refreshSharedBadges };