Skip to content

Commit a1286e6

Browse files
authored
Merge pull request #326 from raymond-rebbeck/main
Fixes for JS errors preventing use of Web UI with Studio
2 parents 37da37d + 80c5cbe commit a1286e6

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
379379
}
380380

381381
if (id === "remote-branches" && idPostfix === "popup") {
382-
const remoteBranchBtns = $("#accordion-remote-branches-popup button").filter((i, span) => jQuery.inArray($(span).text(),refs) != -1);
383-
const widest = Math.max(...remoteBranchBtns.map((i, span) => $(span).width()));
382+
var remoteBranchBtns = $("#accordion-remote-branches-popup button").filter(function (i, span) {
383+
return jQuery.inArray($(span).text(), refs) != -1;
384+
});
385+
var widest = Math.max.apply(Math, remoteBranchBtns.map(function (i, span) {
386+
return $(span).width();
387+
}));
384388
if (remoteBranchBtns.length > 0) {
385389
remoteBranchBtns.css("padding", ".25rem .5rem");
386390
remoteBranchBtns.css("border", 0);
@@ -2199,8 +2203,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21992203
}
22002204
});
22012205

2202-
for (const otherDeveloperItem of Object.keys(otherDeveloperUncommittedItems)) {
2203-
for (const otherDeveloperUsername of otherDeveloperUncommittedItems[otherDeveloperItem]) {
2206+
for (var i = 0, otherDeveloperUncommittedItemsKeys = Object.keys(otherDeveloperUncommittedItems); i < otherDeveloperUncommittedItemsKeys.length; i++) {
2207+
var otherDeveloperItem = otherDeveloperUncommittedItemsKeys[i];
2208+
for (var j = 0, otherDeveloperUncommittedItem = otherDeveloperUncommittedItems[otherDeveloperItem]; j < otherDeveloperUncommittedItem.length; j++) {
2209+
var otherDeveloperUsername = otherDeveloperUncommittedItem[j];
22042210
if (col==1) {
22052211
addItemToFileList(fileList, otherDeveloperUsername, otherDeveloperItem);
22062212
}
@@ -2212,7 +2218,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22122218
});
22132219

22142220
Object.keys(localStorage).filter(function (key) {
2215-
return !filePaths.includes(key);
2221+
return (filePaths.indexOf(key) === -1);
22162222
}).map(function (key) {
22172223
localStorage.removeItem(key);
22182224
});

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,12 @@ webui.SideBarView = function(mainView, noEventHandlers) {
379379
}
380380

381381
if (id === "remote-branches" && idPostfix === "popup") {
382-
const remoteBranchBtns = $("#accordion-remote-branches-popup button").filter((i, span) => jQuery.inArray($(span).text(),refs) != -1);
383-
const widest = Math.max(...remoteBranchBtns.map((i, span) => $(span).width()));
382+
var remoteBranchBtns = $("#accordion-remote-branches-popup button").filter(function (i, span) {
383+
return jQuery.inArray($(span).text(), refs) != -1;
384+
});
385+
var widest = Math.max.apply(Math, remoteBranchBtns.map(function (i, span) {
386+
return $(span).width();
387+
}));
384388
if (remoteBranchBtns.length > 0) {
385389
remoteBranchBtns.css("padding", ".25rem .5rem");
386390
remoteBranchBtns.css("border", 0);
@@ -2199,8 +2203,10 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
21992203
}
22002204
});
22012205

2202-
for (const otherDeveloperItem of Object.keys(otherDeveloperUncommittedItems)) {
2203-
for (const otherDeveloperUsername of otherDeveloperUncommittedItems[otherDeveloperItem]) {
2206+
for (var i = 0, otherDeveloperUncommittedItemsKeys = Object.keys(otherDeveloperUncommittedItems); i < otherDeveloperUncommittedItemsKeys.length; i++) {
2207+
var otherDeveloperItem = otherDeveloperUncommittedItemsKeys[i];
2208+
for (var j = 0, otherDeveloperUncommittedItem = otherDeveloperUncommittedItems[otherDeveloperItem]; j < otherDeveloperUncommittedItem.length; j++) {
2209+
var otherDeveloperUsername = otherDeveloperUncommittedItem[j];
22042210
if (col==1) {
22052211
addItemToFileList(fileList, otherDeveloperUsername, otherDeveloperItem);
22062212
}
@@ -2212,7 +2218,7 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22122218
});
22132219

22142220
Object.keys(localStorage).filter(function (key) {
2215-
return !filePaths.includes(key);
2221+
return (filePaths.indexOf(key) === -1);
22162222
}).map(function (key) {
22172223
localStorage.removeItem(key);
22182224
});

0 commit comments

Comments
 (0)