Skip to content

Commit 1cb4ec4

Browse files
committed
Update filebrowser.js
1 parent 33d6bcf commit 1cb4ec4

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

filebrowser.js

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,40 +1534,46 @@ async function renderBranchMenuHTML(renderAll) {
15341534

15351535
// if branch menu isn't already rendered
15361536
if (getAttr(branchMenu, 'tree') !== [user, repoName, contents].join()) {
1537-
1538-
setAttr(branchMenu, 'tree', [user, repoName, contents].join());
1539-
1537+
15401538
// show loading message
15411539
branchMenu.innerHTML = '<div class="icon selected"><a>Loading...</a></div>';
15421540

1543-
// if branch resp isn't already stored
1544-
// in local storage
1545-
if (!repoObj || !repoObj.branches ||
1546-
repoObj.branchExpiration === undefined ||
1547-
repoObj.branchExpiration < currentTime) {
1548-
1549-
// get branches for repository
1550-
branchResp = await git.getBranches(treeLoc);
1551-
1552-
// if repo dosen't exist, return
1553-
if (branchResp.message) {
1554-
return;
1555-
}
1556-
1557-
// clean resp and save only relevant fields
1558-
const cleanedResp = branchResp.map(branch => {
1559-
return { name: branch.name, commit: { sha: branch.commit.sha } };
1560-
});
1561-
1562-
// save branch resp in local storage
1563-
updateModRepoBranches(fullName, cleanedResp);
1564-
1565-
// save branch expiration date
1566-
// in local storage
1567-
updateModRepoBranchExpiration(fullName, dayFromNow);
1568-
1541+
setAttr(branchMenu, 'tree', [user, repoName, contents].join());
1542+
1543+
}
1544+
1545+
1546+
// if branch resp isn't already stored
1547+
// in local storage
1548+
if (!repoObj || !repoObj.branches ||
1549+
repoObj.branchExpiration === undefined ||
1550+
repoObj.branchExpiration < currentTime) {
1551+
1552+
// get branches for repository
1553+
branchResp = await git.getBranches(treeLoc);
1554+
1555+
// if repo dosen't exist, return
1556+
if (branchResp.message) {
1557+
return;
15691558
}
1570-
1559+
1560+
// clean resp and save only relevant fields
1561+
const cleanedResp = branchResp.map(branch => {
1562+
return {
1563+
name: branch.name,
1564+
commit: {
1565+
sha: branch.commit.sha
1566+
}
1567+
};
1568+
});
1569+
1570+
// save branch resp in local storage
1571+
updateModRepoBranches(fullName, cleanedResp);
1572+
1573+
// save branch expiration date
1574+
// in local storage
1575+
updateModRepoBranchExpiration(fullName, dayFromNow);
1576+
15711577
}
15721578

15731579

0 commit comments

Comments
 (0)