Skip to content

Commit a6afbb4

Browse files
vdberghppigazzini
authored andcommitted
Squash and rebase
The "Branch" pane now has a button "squash and rebase". This can be tested by setting oneself in the "Advanced" pane as srcUser and letting the srcBranch be a branch in one's own repo. In the console one can follow the api calls.
1 parent d7bb5ed commit a6afbb4

File tree

6 files changed

+680
-268
lines changed

6 files changed

+680
-268
lines changed

server/fishtest/static/js/application.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ function log(message, trace) {
168168
}
169169

170170
async function processError(e) {
171+
if (!(e instanceof Error)) {
172+
return String(e);
173+
}
171174
let text = e.message;
172175
if (e instanceof HTTPError) {
173176
const response = e.response;
@@ -206,6 +209,8 @@ async function processError(e) {
206209
target='_blank'>GitHub personal access token</a> to your <a href='/user'>profile</a>
207210
or else use 'View on GitHub'.`;
208211
}
212+
} else if (e.cause) {
213+
text += `<br>This error is caused by:<br>${await processError(e.cause)}`;
209214
}
210215
return text;
211216
}
@@ -420,14 +425,17 @@ function loadObject(key) {
420425
return JSON.parse(value_);
421426
}
422427

423-
function escapeHtml(unsafe) {
424-
return unsafe
425-
.replace(/&/g, "&amp;")
426-
.replace(/</g, "&lt;")
427-
.replace(/>/g, "&gt;")
428-
.replace(/"/g, "&quot;")
429-
.replace(/'/g, "&#039;")
430-
.replace(/\n/g, "<br>");
428+
// Escapes &, <, >, ", ' — idempotently
429+
function escapeHtml(input) {
430+
return (
431+
String(input)
432+
// & → &amp; (but skip existing entities like &amp; &lt; &#123; &#x1F4A9;)
433+
.replace(/&(?!#\d+;|#x[0-9A-Fa-f]+;|\w+;)/g, "&amp;")
434+
.replace(/</g, "&lt;")
435+
.replace(/>/g, "&gt;")
436+
.replace(/"/g, "&quot;")
437+
.replace(/'/g, "&#39;")
438+
);
431439
}
432440

433441
function handleSortingTables() {
@@ -687,3 +695,15 @@ function isClassicPAT(token) {
687695
const pattern = /^ghp_[a-zA-Z0-9]{36}$/;
688696
return token.match(pattern) != null;
689697
}
698+
699+
function htmlToText(html) {
700+
const htmlViewer = document.createElement("div");
701+
// FF can use overflow:hidden but Safari on iPad does not render it
702+
htmlViewer.textCSS =
703+
"height:0;position:fixed;top:0;font-size:xx-small;opacity:0;";
704+
document.body.prepend(htmlViewer);
705+
htmlViewer.innerHTML = html;
706+
const text = htmlViewer.innerText;
707+
htmlViewer.remove();
708+
return text;
709+
}

0 commit comments

Comments
 (0)