diff --git a/filebrowser.js b/filebrowser.js index ddf8b317a6..d2d229c25a 100644 --- a/filebrowser.js +++ b/filebrowser.js @@ -53,6 +53,11 @@ async function renderSidebarHTML() { if (loader.style.opacity != '1') { startLoading(); } + + // show loading items + fileWrapper.classList.add('loading-items'); + + fileWrapper.style.setProperty('--scroll-top', sidebar.scrollTop + 'px'); // hide search screen header.classList.remove('searching'); @@ -91,6 +96,9 @@ async function renderSidebarHTML() { // stop loading stopLoading(); + + // hide loading items + fileWrapper.classList.remove('loading-items'); // show intro screen fileWrapper.innerHTML = fileIntroScreen; @@ -126,13 +134,14 @@ async function renderSidebarHTML() { const currentTime = new Date().getTime(); // if repo obj dosen't exist + // or repo obj data has expired if (!repoObj || !repoObj.defaultBranch || repoObj.repoDataExpiration === undefined || repoObj.branchExpiration === undefined || repoObj.repoDataExpiration < currentTime) { - // get repo obj from git + // fetch repo obj from git // and save to modified repos - fetchRepoAndSaveToModRepos(treeLoc); + modRepos.fetchAndAddRepoObj(treeLoc); } @@ -144,7 +153,7 @@ async function renderSidebarHTML() { // if sidebar title is empty - if (sidebarLogo.innerText === '') { + if (/* sidebarLogo.innerText === '' */ true) { if (contents != '') { @@ -174,6 +183,10 @@ async function renderSidebarHTML() { onNextFrame(() => { sidebarLogo.classList.remove('notransition'); }); + + + // change header options + header.classList.remove('out-of-repo'); } else if (repo != '') { @@ -200,6 +213,10 @@ async function renderSidebarHTML() { onNextFrame(() => { sidebarLogo.classList.remove('notransition'); }); + + + // change header options + header.classList.remove('out-of-repo'); } else { @@ -219,6 +236,10 @@ async function renderSidebarHTML() { onNextFrame(() => { sidebarLogo.classList.remove('notransition'); }); + + + // change header options + header.classList.add('out-of-repo'); } @@ -228,6 +249,16 @@ async function renderSidebarHTML() { // get items in current tree from git resp = await git.getItems(treeLoc); + + // if switched directory while loading, return + if (user !== treeLoc[0] || + repoName !== treeLoc[1].split(':')[0] || + contents !== treeLoc[2]) { + + return; + + } + if (resp.message && resp.message == 'Not Found') { @@ -236,6 +267,41 @@ async function renderSidebarHTML() { // stop loading stopLoading(); + // change location + treeLoc[1] = ''; + treeLoc[2] = ''; + saveTreeLocLS(treeLoc); + + + // if already viewing repositories page + if (fileWrapper.querySelector('.item.repo')) { + + // hide loading items + fileWrapper.classList.remove('loading-items'); + + + // remove nonexistent repo + const nonExistentRepo = fileWrapper.querySelector('.item.repo[fullname="'+ (user + '/' + repoName) +'"], ' + + '.item.repo[repoobj^="%7B%22fullName%22:%22' + (user + '/' + repoName) + '%22"]'); + + if (nonExistentRepo) nonExistentRepo.remove(); + + + // change sidebar title + sidebarLogo.innerText = 'Repositories'; + + // hide branch button + sidebarBranch.classList.remove('visible'); + + // scroll to start of repo name + sidebarLogo.scrollTo(0, 0); + scrolledSidebarTitle(); + + // change header options + header.classList.add('out-of-repo'); + + } + // get repo obj from local storage const repoObj = modifiedRepos[user + '/' + repoName]; @@ -244,7 +310,7 @@ async function renderSidebarHTML() { if (repoObj) { // delete repo obj from modified repos - deleteModRepo(user + '/' + repoName); + modRepos.removeRepo(user + '/' + repoName); } @@ -264,22 +330,14 @@ async function renderSidebarHTML() { } - // change location - treeLoc[1] = ''; - treeLoc[2] = ''; - saveTreeLocLS(treeLoc); - - // change sidebar title - sidebarLogo.innerText = 'Repositories'; - - // hide branch button - sidebarBranch.classList.remove('visible'); - - // scroll to start of repo name - sidebarLogo.scrollTo(0, 0); - scrolledSidebarTitle(); + // if not viewing repositories page + if (!fileWrapper.querySelector('.item.repo')) { + + // render sidebar + renderSidebarHTML(); + + } - renderSidebarHTML(); return; @@ -291,6 +349,9 @@ async function renderSidebarHTML() { // stop loading stopLoading(); + + // hide loading items + fileWrapper.classList.add('loading-items'); // get repo obj from local storage @@ -806,6 +867,9 @@ async function renderSidebarHTML() { // stop loading stopLoading(); + + // hide loading items + fileWrapper.classList.remove('loading-items'); // add item event listeners addHTMLItemListeners(); @@ -867,7 +931,7 @@ function addHTMLItemListeners() { if (getAttr(item, 'repoObj')) { // add repo obj to modified repos - addRepoToModRepos(repoObj); + modRepos.addRepo(repoObj); } @@ -1083,11 +1147,11 @@ async function checkPushDialogs() { if (!repoObj || repoObj.pushAccess === null) { // await repo obj promise - if (repoPromise) { + if (pendingPromise.repoObjFetch) { showMessage('Just a sec..', -1); - await repoPromise; + await pendingPromise.repoObjFetch; repoObj = modifiedRepos[user + '/' + repoName]; @@ -1234,10 +1298,10 @@ async function pushFileFromHTML(fileEl, commitMessage) { bottomFloat.classList.remove('modified'); - // if the current file hasn't been pushed yet, - // await file creation + // if the current file hasn't been created yet, + // await its creation - const newFilePendingPromise = newFilePendingPromises[getAttr(fileEl, 'sha')]; + const newFilePendingPromise = pendingPromise.newFile[getAttr(fileEl, 'sha')]; if (newFilePendingPromise) { @@ -1679,10 +1743,10 @@ async function renderBranchMenuHTML(renderAll) { // if default branch isn't fetched yet if (!repoObj.selBranch) { - + // await fetch - await repoPromise; - + await pendingPromise.repoObjFetch; + repoObj = modifiedRepos[fullName]; } @@ -1884,7 +1948,7 @@ sidebarTitle.addEventListener('click', (e) => { // if there are no modified files // and no pending promises if (Object.values(modifiedFiles).length === 0 - && !pendingPromise && !repoPromise) { + && !pendingPromise) { // enable logout learnWrapper.classList.add('logout-enabled'); @@ -2215,7 +2279,7 @@ function createNewRepoInHTML() { true, null, repoPrivate, false, true, 0, 0); // add repo obj to modified repos - addRepoToModRepos(repoObj); + modRepos.addRepo(repoObj); // wait for push animation to finish, @@ -2253,8 +2317,6 @@ function createNewRepoInHTML() { // create new file // on click of button -const newFilePendingPromises = {}; - function createNewFileInHTML() { // if not already adding new file @@ -2431,7 +2493,33 @@ function createNewFileInHTML() { // change selected file changeSelectedFile(treeLoc.join(), tempSHA, fileName, encodeUnicode('\r\n'), getFileLang(fileName), [0, 0], [0, 0], true); + + // close file view if open + if (liveView.classList.contains('file-open')) { + + liveView.classList.add('notransition'); + liveView.classList.remove('file-open'); + + onNextFrame(() => { + + liveView.classList.remove('notransition'); + }); + + // if on mobile device + if (isMobile) { + + // update bottom float + bottomFloat.classList.remove('file-open'); + + } else { + + liveToggle.classList.remove('file-open'); + + } + + } + // if on mobile device if (isMobile) { @@ -2482,11 +2570,11 @@ function createNewFileInHTML() { } - // if a pending promise exists, - // await it - if (pendingPromise) { + // if the current repository is being created, + // await its creation + if (pendingPromise.createRepo) { - await pendingPromise; + await pendingPromise.createRepo; } @@ -2507,11 +2595,13 @@ function createNewFileInHTML() { // push file asynchronously - newFilePendingPromises[tempSHA] = git.push(commit); + // save new file creation promise in object + pendingPromise.newFile[tempSHA] = git.push(commit); - const newSHA = await newFilePendingPromises[tempSHA]; + const newSHA = await pendingPromise.newFile[tempSHA]; - delete newFilePendingPromises[tempSHA]; + // remove file creation promise from object + delete pendingPromise.newFile[tempSHA]; // Git file is eclipsed (not updated) in browser private cache, @@ -2797,17 +2887,41 @@ function toggleSidebar(open) { } -function deleteModFileInHTML(fileEl) { +async function deleteModFileInHTML(fileEl) { - const fileSha = getAttr(fileEl, 'sha'); + let fileSha = getAttr(fileEl, 'sha'); + + // if pushing file + if (pendingPromise.latestPushedFile) { + + showMessage('Discarding changes...', -1); + + // await pending promise + await pendingPromise.latestPushedFile; + + hideMessage(); + + // get updated file sha + fileSha = getAttr(fileEl, 'sha'); + + } deleteModFile(fileSha); + fileEl.classList.remove('modified'); if (fileEl.classList.contains('selected')) { - loadFileInHTML(fileEl, fileSha); + const scrollPos = selectedFile.scrollPos; + + await loadFileInHTML(fileEl, fileSha); + + // prevent bottom float disappearing on mobile + if (isMobile) lastScrollTop = scrollPos[1]; + + // scroll to pos in code + cd.scrollTo(scrollPos[0], scrollPos[1]); } @@ -3155,6 +3269,7 @@ function setupEditor() { // get selection language let selLang = Prism.util.getLanguage(cursorEl); if (selLang == 'javascript') selLang = 'js'; + if (selLang == 'json') selLang = 'js'; if (selLang == 'markup') selLang = 'html'; // find syntax for language @@ -3165,7 +3280,14 @@ function setupEditor() { // beautify beautifierOptions.indent_char = cd.options.tab[0]; - const beautifiedText = beautifyLang(selText, beautifierOptions); + let beautifiedText = beautifyLang(selText, beautifierOptions); + + // prevent deleting ending newline when beautifying + if (selText.endsWith('\n') && !beautifiedText.endsWith('\n')) { + + beautifiedText += '\n'; + + } // compare current code with new code // if the code is different, swap it diff --git a/full.css b/full.css index 6cd8e1c1e0..7770e80bb5 100644 --- a/full.css +++ b/full.css @@ -761,6 +761,10 @@ body.notransition .sidebar { transition: none; } +.sidebar.loading:has(> .content-wrapper .files.loading-items) { + overflow-y: hidden; +} + .sidebar .wrapper { width: 100%; height: max-content; @@ -1175,6 +1179,7 @@ body:not(.mobile) .sidebar .header .title .branch-icon:active { .sidebar .header.searching .logo { padding-left: 7px; + overflow-x: hidden; max-width: calc(var(--sidebar-width) - 140px - 16px - 7px - 7px - 7px); } @@ -1192,6 +1197,44 @@ body:not(.mobile) .sidebar .header .title .branch-icon:active { } +.sidebar .files.loading-items::before, +.sidebar .files.loading-items::after { + content: ''; + position: absolute; + top: calc(85px - 11px + var(--scroll-top, 0px)); + height: calc(100% - 85px + 11px); + background-position-y: 11px; + background-color: #1a1c24; + background-repeat-x: no-repeat; + z-index: 1; +} + +.sidebar .files::before { + background-image: var(--file-placeholder); + background-size: 201px 54px; + width: calc(100% - 1px); + left: 0; + --file-placeholder: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20201%2054%22%3E%20%3Cpath%20fill%3D%22%231a1c23%22%20d%3D%22M0%200h201v54H0z%22%2F%3E%20%3Cg%20opacity%3D%22.3%22%3E%20%3Cpath%20fill%3D%22%23d4d5d7%22%20fill-opacity%3D%22.1%22%20d%3D%22M201%2022.124c-.002-2.674-2.201-4.873-4.875-4.875H55.875c-2.674.002-4.873%202.201-4.874%204.875v9.751c.001%202.674%202.2%204.873%204.874%204.875h140.25c2.674-.002%204.873-2.201%204.875-4.875v-9.751Z%22%2F%3E%20%3Cpath%20fill%3D%22none%22%20d%3D%22M20%2015.029h24v24H20z%22%2F%3E%20%3Cpath%20fill%3D%22%23828689%22%20d%3D%22M34.59%2017.619c-.38-.38-.89-.59-1.42-.59H26c-1.1%200-2%20.9-2%202v16c0%201.1.89%202%201.99%202H38c1.1%200%202-.9%202-2v-11.17c0-.53-.21-1.04-.59-1.41l-4.82-4.83Zm.41%2015.41h-6c-.55%200-1-.45-1-1s.45-1%201-1h6c.55%200%201%20.45%201%201s-.45%201-1%201Zm0-4h-6c-.55%200-1-.45-1-1s.45-1%201-1h6c.55%200%201%20.45%201%201s-.45%201-1%201Zm-2-6v-4.5l5.5%205.5H34c-.55%200-1-.45-1-1Z%22%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E'); +} + +.sidebar .header.out-of-repo + .files::before { + background-image: var(--repo-placeholder); + --repo-placeholder: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20201%2054%22%3E%20%3Cpath%20fill%3D%22%231a1c23%22%20d%3D%22M0%200h201v54H0z%22%2F%3E%20%3Cg%20opacity%3D%22.3%22%3E%20%3Cpath%20fill%3D%22none%22%20d%3D%22M20%2015.029h24v24H20z%22%2F%3E%20%3Cpath%20fill%3D%22%23828689%22%20d%3D%22M23%2018.94a3.787%203.787%200%200%201%203.75-3.752h13.125A1.136%201.136%200%200%201%2041%2016.311v18.756a1.135%201.135%200%200%201-1.125%201.126h-3.75A1.136%201.136%200%200%201%2035%2035.068a1.135%201.135%200%200%201%201.125-1.124h2.625v-3.001h-12c-.823%200-1.5.677-1.5%201.5%200%20.391.154.77.429%201.05a1.125%201.125%200%200%201-.801%201.914h-.003c-.302%200-.592-.123-.804-.339A3.744%203.744%200%200%201%2023%2032.443V18.94Zm15.75-1.501v11.253h-12c-.534%200-1.041.11-1.5.311V18.94c0-.823.677-1.5%201.5-1.5h12ZM27.5%2033.569v4.875a.377.377%200%200%200%20.6.3l2.175-1.63c.133-.1.317-.1.45%200l2.175%201.63a.376.376%200%200%200%20.6-.3v-4.875a.378.378%200%200%200-.375-.377h-5.25a.378.378%200%200%200-.375.377Z%22%20fill-rule%3D%22evenodd%22%2F%3E%20%3Cpath%20fill%3D%22%23d4d5d7%22%20fill-opacity%3D%22.1%22%20d%3D%22M201%2022.124c-.002-2.674-2.201-4.873-4.875-4.875H55.875c-2.674.002-4.873%202.201-4.874%204.875v9.751c.001%202.674%202.2%204.873%204.874%204.875h140.25c2.674-.002%204.873-2.201%204.875-4.875v-9.751Z%22%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E'); +} + +.sidebar .files::after { + background-image: var(--arrow-placeholder); + background-size: 44px 54px; + width: 44px; + right: 1px; + --arrow-placeholder: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2044%2054%22%3E%20%3Cpath%20fill%3D%22%231a1c23%22%20d%3D%22M0%200h44v54H0z%22%2F%3E%20%3Cg%20opacity%3D%22.3%22%3E%20%3Cpath%20fill%3D%22none%22%20d%3D%22M0%2015h24v24H0z%22%2F%3E%20%3Cpath%20fill%3D%22%23828689%22%20d%3D%22M9.29%2021.71a.998.998%200%200%200%200%201.41L13.17%2027l-3.88%203.88a.998.998%200%200%200%201.41%201.41l4.59-4.59a.998.998%200%200%200%200-1.41L10.7%2021.7c-.38-.38-1.02-.38-1.41.01Z%22%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E'); +} + +.sidebar .header:not(.out-of-repo) + .files::after { + content: unset; +} + + .sidebar .item { display: flex; align-items: center; @@ -1283,7 +1326,7 @@ body:not(.mobile) .sidebar .header .title .branch-icon:active { text-overflow: clip; background: hsl(220deg 86% 64% / 9%); box-shadow: 0 0 0 2px hsl(223deg 85% 66% / 70%); - transition: .18s .04s var(--ease-function); + transition: .18s var(--ease-function); transition-property: background, box-shadow; } diff --git a/git/gitapi.js b/git/gitapi.js index 8543f2b27b..e1781ec90b 100644 --- a/git/gitapi.js +++ b/git/gitapi.js @@ -1,19 +1,34 @@ // change pushing state -let pendingPromise; +let pendingPromise = { + createRepo: null, + repoObjFetch: null, + latestPushedFile: null, + newFile: {} // new file creation promises +}; -function changePushingState(to, pendingPromise) { +function changePushingState(to, promiseType, promise) { if (to === true) { - - pendingPromise = pendingPromise ?? null; + + if (promiseType && promise) { + + pendingPromises[promiseType] = promise; + + } window.addEventListener('beforeunload', beforeUnloadListener, {capture: true}); } else { - - pendingPromise = null; + + // clear pending promise + if (promiseType && + promise === pendingPromises[promiseType]) { + + pendingPromises[promiseType] = null; + + } window.removeEventListener('beforeunload', beforeUnloadListener, {capture: true}); @@ -259,13 +274,14 @@ let git = { // change pushing state - changePushingState(true); + // and save pending file promise + changePushingState(true, 'latestPushedFile', postRequest); // put the query const resp = await axios.put(query, gitToken, commitData); // change pushing state - changePushingState(false); + changePushingState(false, 'latestPushedFile', postRequest); return resp.content.sha; @@ -287,13 +303,13 @@ let git = { const postRequest = axios.post(query, gitToken, repoData); // change pushing state - changePushingState(true, postRequest); + changePushingState(true, 'createRepo', postRequest); // await the request const resp = await postRequest; // change pushing state - changePushingState(false); + changePushingState(false, 'createRepo', postRequest); return resp.full_name; @@ -431,3 +447,4 @@ let git = { } }; + diff --git a/repos.js b/repos.js index ba3bcd4ec9..82e6ea9cd2 100644 --- a/repos.js +++ b/repos.js @@ -23,168 +23,182 @@ function createRepoObj(fullName, selBranch, defaultBranch, // modified repos -function addRepoToModRepos(repoObj) { - - modifiedRepos[repoObj.fullName] = repoObj; - - updateModReposLS(); - -} - -function deleteModRepo(fullName) { - - delete modifiedRepos[fullName]; - - updateModReposLS(); - -} - -function updateModRepoSelectedBranch(fullName, selBranch) { - - modifiedRepos[fullName].selBranch = selBranch; - - if (!isEmbed) { - updateModReposLS(); - } - -} - -function updateModRepoDefaultBranch(fullName, defaultBranch) { - - modifiedRepos[fullName].defaultBranch = defaultBranch; - - updateModReposLS(); - -} - -function updateModRepoPushAccess(fullName, pushAccess) { - - modifiedRepos[fullName].pushAccess = pushAccess; - - updateModReposLS(); - -} - -function updateModRepoBranches(fullName, branches) { - - modifiedRepos[fullName].branches = branches; - - updateModReposLS(); - -} - -function updateModRepoPrivateStatus(fullName, private) { - - modifiedRepos[fullName].private = private; - - updateModReposLS(); - -} - -function updateModRepoEmptyStatus(fullName, empty) { +let modRepos = { - modifiedRepos[fullName].empty = empty; - - updateModReposLS(); - -} + addRepo: (repoObj) => { -function updateModRepoDataExpiration(fullName, time) { + modifiedRepos[repoObj.fullName] = repoObj; - modifiedRepos[fullName].repoDataExpiration = time; - - updateModReposLS(); - -} - -function updateModRepoBranchExpiration(fullName, time) { - - modifiedRepos[fullName].branchExpiration = time; - - updateModReposLS(); - -} - - - -// get repo obj from git -// and save to modified repos + updateModReposLS(); -let repoPromise; + }, -async function fetchRepoAndSaveToModRepos(treeLoc) { - - // get full name of repository - const fullName = treeLoc[0] + '/' + treeLoc[1].split(':')[0]; - const selBranch = treeLoc[1].split(':')[1]; - - - // create temporary repo object - const tempRepoObj = createRepoObj(fullName, selBranch, null, - null, null, null, null, null, 0, 0); - - // add temp repo object - // to modified repos - addRepoToModRepos(tempRepoObj); + removeRepo: (fullName) => { + + delete modifiedRepos[fullName]; + + updateModReposLS(); + }, - // get repository from git - - // create promise - repoPromise = git.getRepo(treeLoc); - - // await promise - const repo = await repoPromise; - - // remove promise - repoPromise = null; - + updateRepo: (fullName) => { + + return { + + selBranchTo: (branch) => { + + modifiedRepos[fullName].selBranch = branch; + + if (!isEmbed) { + updateModReposLS(); + } + + }, + + defaultBranchTo: (branch) => { + + modifiedRepos[fullName].defaultBranch = branch; + + updateModReposLS(); + + }, + + pushAccessTo: (pushAccess) => { + + modifiedRepos[fullName].pushAccess = pushAccess; + + updateModReposLS(); + + }, + + branchesTo: (branches) => { + + modifiedRepos[fullName].branches = branches; + + updateModReposLS(); + + }, + + privateStatusTo: (privateStatus) => { + + modifiedRepos[fullName].private = privateStatus; + + updateModReposLS(); + + }, + + emptyStatusTo: (emptyStatus) => { + + modifiedRepos[fullName].empty = emptyStatus; + + updateModReposLS(); + + }, + + dataExpirationTo: (time) => { + + modifiedRepos[fullName].repoDataExpiration = time; + + updateModReposLS(); + + }, + + branchExpirationTo: (time) => { + + modifiedRepos[fullName].branchExpiration = time; + + updateModReposLS(); + + } + + }; + + }, - // if didn't encounter an error - if (!repo.message) { - - // check temp repo changed - const tempRepo = modifiedRepos[fullName]; - - - // get repo data expiration time - // (two months from now) - - let expirationDate = new Date(); - expirationDate.setDate(expirationDate.getDate() + (2 * 4 * 7)); - - const twoMonthsTime = expirationDate.getTime(); - - - // create repo obj - const repoObj = createRepoObj(fullName, - - (tempRepo.selBranch ?? repo.default_branch), - - repo.default_branch, - - (tempRepo.pushAccess ?? ((repo.permissions && repo.permissions.push) ?? false)), - - (tempRepo.branches ?? null), - - repo.private, repo.fork, - - (tempRepo.empty ?? false), - - twoMonthsTime, - - tempRepo.branchExpiration); - - // add repo object + // fetch repo obj from git + // and save to modified repos + fetchAndAddRepoObj: async (treeLoc) => { + + // get full name of repository + const fullName = treeLoc[0] + '/' + treeLoc[1].split(':')[0]; + const selBranch = treeLoc[1].split(':')[1]; + + + // create temporary repo object + const tempRepoObj = createRepoObj(fullName, selBranch, null, + null, null, null, null, null, 0, 0); + + // add temp repo object // to modified repos - addRepoToModRepos(repoObj); + modRepos.addRepo(tempRepoObj); + + + // get repository from git + + // create promise + const repoPromise = git.getRepo(treeLoc); + + // save promise in global object + pendingPromise.repoObjFetch = repoPromise; - } else { + // await promise + const repo = await repoPromise; - // remove temp repo object - // from modified repos - deleteModRepo(fullName); + // remove promise from global object + if (repoPromise === pendingPromise.repoObjFetch) { + + pendingPromise.repoObjFetch = null; + + } + + + // if didn't encounter an error + if (!repo.message) { + + // get repo data expiration time + // (two months from now) + + let expirationDate = new Date(); + expirationDate.setDate(expirationDate.getDate() + (2 * 4 * 7)); + + const twoMonthsTime = expirationDate.getTime(); + + + const tempRepo = modifiedRepos[fullName]; + + // create repo obj, + // while preserving changed properties from the temporary repo + const repoObj = createRepoObj(fullName, + + (tempRepo.selBranch ?? repo.default_branch), // check if changed selected branch while fetching repo obj + + repo.default_branch, + + (tempRepo.pushAccess ?? ((repo.permissions && repo.permissions.push) ?? false)), // check for push access in repo + + (tempRepo.branches ?? null), // check if finished fetching repo branches + + repo.private, repo.fork, + + (tempRepo.empty ?? false), // check if created file in empty repo while fetching repo obj + + twoMonthsTime, // repo data expiration time + + tempRepo.branchExpiration); // check if finished fetching repo branches + + // add repo object + // to modified repos + modRepos.addRepo(repoObj); + + } else { // if encountered an error + + // remove temp repo object + // from modified repos + modRepos.removeRepo(fullName); + + } } -} +}; +