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

Function initFolderAccessSourceSelector

public/js/adminFolderAccess.js:69–100  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

67}
68
69async function initFolderAccessSourceSelector(opts = {}) {
70 const rowId = opts.rowId || 'folderAccessSourceRow';
71 const selectId = opts.selectId || 'folderAccessSourceSelect';
72 const onChange = typeof opts.onChange === 'function' ? opts.onChange : null;
73 const row = document.getElementById(rowId);
74 const selectEl = document.getElementById(selectId);
75 if (!row || !selectEl) return;
76
77 const data = await loadFolderAccessSources();
78 if (!data || !Array.isArray(data.sources) || data.sources.length <= 1) {
79 row.style.display = 'none';
80 __aclSourceId = (data && data.activeId) ? String(data.activeId) : '';
81 selectEl.__onSourceChange = onChange;
82 return;
83 }
84
85 row.style.display = '';
86 populateFolderAccessSourceSelect(selectEl, data.sources, data.activeId || '');
87 __aclSourceId = selectEl.value || '';
88 selectEl.__onSourceChange = onChange;
89
90 if (!selectEl.__wired) {
91 selectEl.__wired = true;
92 selectEl.addEventListener('change', () => {
93 __aclSourceId = selectEl.value || '';
94 __allFoldersCache = new Map();
95 if (typeof selectEl.__onSourceChange === 'function') {
96 selectEl.__onSourceChange(__aclSourceId);
97 }
98 });
99 }
100}
101
102function escapeFolderSelectorValue(folder) {
103 const value = String(folder ?? '');

Callers 2

openUserPermissionsModalFunction · 0.85
openGroupAclEditorFunction · 0.85

Calls 2

loadFolderAccessSourcesFunction · 0.85

Tested by

no test coverage detected