1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 06:57:20 +00:00

Merge index.js (#34963)

Fix #34960
This commit is contained in:
wxiaoguang
2025-07-06 12:55:16 +08:00
committed by GitHub
parent 479757f61b
commit 429efc8b4f
9 changed files with 212 additions and 210 deletions

View File

@ -20,6 +20,10 @@ function shouldIgnoreError(err: Error) {
export function showGlobalErrorMessage(msg: string, msgType: Intent = 'error') {
const msgContainer = document.querySelector('.page-content') ?? document.body;
if (!msgContainer) {
alert(`${msgType}: ${msg}`);
return;
}
const msgCompact = msg.replace(/\W/g, '').trim(); // compact the message to a data attribute to avoid too many duplicated messages
let msgDiv = msgContainer.querySelector<HTMLDivElement>(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
if (!msgDiv) {