aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/modules/toast.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-02 23:05:07 +0800
committerGitHub <noreply@github.com>2024-03-02 15:05:07 +0000
commit27deea7330f83ddb37c918afbb4159053d8847cb (patch)
treec55636fff59079106a013430076817f9a380f356 /web_src/js/modules/toast.js
parentcc27b50bdf9d1e2b02c91d7c4d338e01408e8522 (diff)
downloadgitea-27deea7330f83ddb37c918afbb4159053d8847cb.tar.gz
gitea-27deea7330f83ddb37c918afbb4159053d8847cb.zip
Make PR form use toast to show error message (#29545)
![image](https://github.com/go-gitea/gitea/assets/2114189/b7a14ed6-db89-4f21-a590-66cd33307233)
Diffstat (limited to 'web_src/js/modules/toast.js')
-rw-r--r--web_src/js/modules/toast.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/web_src/js/modules/toast.js b/web_src/js/modules/toast.js
index fa075aed48..d64359799c 100644
--- a/web_src/js/modules/toast.js
+++ b/web_src/js/modules/toast.js
@@ -21,13 +21,12 @@ const levels = {
};
// See https://github.com/apvarun/toastify-js#api for options
-function showToast(message, level, {gravity, position, duration, ...other} = {}) {
+function showToast(message, level, {gravity, position, duration, useHtmlBody, ...other} = {}) {
const {icon, background, duration: levelDuration} = levels[level ?? 'info'];
-
const toast = Toastify({
text: `
<div class='toast-icon'>${svg(icon)}</div>
- <div class='toast-body'>${htmlEscape(message)}</div>
+ <div class='toast-body'>${useHtmlBody ? message : htmlEscape(message)}</div>
<button class='toast-close'>${svg('octicon-x')}</button>
`,
escapeMarkup: false,