MCPcopy Create free account
hub / github.com/error311/FileRise / fetchFolderCaps

Function fetchFolderCaps

public/js/fileListView.js:4445–4479  ·  view source on GitHub ↗
(folder, sourceId = '')

Source from the content-addressed store, hash-verified

4443window.__FR_CAPS_INFLIGHT = _folderCapsInflight;
4444
4445async function fetchFolderCaps(folder, sourceId = '') {
4446 if (!folder) return null;
4447 const key = folderCacheKey(folder, sourceId);
4448 if (_folderCapsCache.has(key)) {
4449 return _folderCapsCache.get(key);
4450 }
4451 if (_folderCapsInflight.has(key)) {
4452 return _folderCapsInflight.get(key);
4453 }
4454
4455 const p = (async () => {
4456 try {
4457 const sourceParam = sourceId ? `&sourceId=${encodeURIComponent(sourceId)}` : '';
4458 const res = await fetch(
4459 withBase(`/api/folder/capabilities.php?folder=${encodeURIComponent(folder)}${sourceParam}`),
4460 { credentials: 'include' }
4461 );
4462 const data = await safeJson(res);
4463 _folderCapsCache.set(key, data || null);
4464
4465 if (data && (data.owner || data.user)) {
4466 _folderOwnerCache.set(key, data.owner || data.user || "");
4467 }
4468 return data || null;
4469 } catch (e) {
4470 _folderCapsCache.set(key, null);
4471 return null;
4472 } finally {
4473 _folderCapsInflight.delete(key);
4474 }
4475 })();
4476
4477 _folderCapsInflight.set(key, p);
4478 return p;
4479}
4480
4481async function refreshCurrentFolderCaps(folder, sourceId = '', paneKey = '') {
4482 const pane = paneKey ? normalizePaneKey(paneKey) : normalizePaneKey(window.activePane);

Callers 6

wireFolderStripItemsFunction · 0.85
fillHoverPreviewForRowFunction · 0.85
refreshCurrentFolderCapsFunction · 0.85
fetchFolderOwnerFunction · 0.85
injectInlineFolderRowsFunction · 0.85

Calls 6

folderCacheKeyFunction · 0.85
withBaseFunction · 0.85
setMethod · 0.80
safeJsonFunction · 0.70
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected