fix(shares): fix outgoing shares when browsing in files, fix shareBadge action to open shareDialog
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user