From 4b238930cc1ae7fff3dd26616a36963f805b38cb Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 22 Feb 2026 13:45:27 +0800 Subject: [PATCH] fix --- models/issues/comment.go | 1 + web_src/js/features/projects/workflow.ts | 97 +++++++++++------------- 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 37a95a70c1..8ffe4f4d48 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -812,6 +812,7 @@ func (c *Comment) MetaSpecialDoerTr(locale translation.Locale) template.HTML { } return res default: + // don't trust the content of SpecialDoerName, it might not be fully controlled by us return htmlutil.HTMLFormat("%s", c.CommentMetaData.SpecialDoerName) } } diff --git a/web_src/js/features/projects/workflow.ts b/web_src/js/features/projects/workflow.ts index 75b98fa9c7..b2543747f2 100644 --- a/web_src/js/features/projects/workflow.ts +++ b/web_src/js/features/projects/workflow.ts @@ -5,56 +5,51 @@ export async function initProjectWorkflow() { const workflowDiv = document.querySelector('#project-workflows'); if (!workflowDiv) return; - try { - const locale = { - defaultWorkflows: workflowDiv.getAttribute('data-locale-default-workflows'), - moveToColumn: workflowDiv.getAttribute('data-locale-move-to-column'), - viewWorkflowConfiguration: workflowDiv.getAttribute('data-locale-view-workflow-configuration'), - configureWorkflow: workflowDiv.getAttribute('data-locale-configure-workflow'), - when: workflowDiv.getAttribute('data-locale-when'), - runWhen: workflowDiv.getAttribute('data-locale-run-when'), - filters: workflowDiv.getAttribute('data-locale-filters'), - applyTo: workflowDiv.getAttribute('data-locale-apply-to'), - whenMovedFromColumn: workflowDiv.getAttribute('data-locale-when-moved-from-column'), - whenMovedToColumn: workflowDiv.getAttribute('data-locale-when-moved-to-column'), - onlyIfHasLabels: workflowDiv.getAttribute('data-locale-only-if-has-labels'), - actions: workflowDiv.getAttribute('data-locale-actions'), - addLabels: workflowDiv.getAttribute('data-locale-add-labels'), - removeLabels: workflowDiv.getAttribute('data-locale-remove-labels'), - anyLabel: workflowDiv.getAttribute('data-locale-any-label'), - anyColumn: workflowDiv.getAttribute('data-locale-any-column'), - issueState: workflowDiv.getAttribute('data-locale-issue-state'), - none: workflowDiv.getAttribute('data-locale-none'), - noChange: workflowDiv.getAttribute('data-locale-no-change'), - edit: workflowDiv.getAttribute('data-locale-edit'), - delete: workflowDiv.getAttribute('data-locale-delete'), - save: workflowDiv.getAttribute('data-locale-save'), - clone: workflowDiv.getAttribute('data-locale-clone'), - cancel: workflowDiv.getAttribute('data-locale-cancel'), - disable: workflowDiv.getAttribute('data-locale-disable'), - disabled: workflowDiv.getAttribute('data-locale-disabled'), - enabled: workflowDiv.getAttribute('data-locale-enabled'), - enable: workflowDiv.getAttribute('data-locale-enable'), - issuesAndPullRequests: workflowDiv.getAttribute('data-locale-issues-and-pull-requests'), - issuesOnly: workflowDiv.getAttribute('data-locale-issues-only'), - pullRequestsOnly: workflowDiv.getAttribute('data-locale-pull-requests-only'), - selectColumn: workflowDiv.getAttribute('data-locale-select-column'), - closeIssue: workflowDiv.getAttribute('data-locale-close-issue'), - reopenIssue: workflowDiv.getAttribute('data-locale-reopen-issue'), - saveWorkflowFailed: workflowDiv.getAttribute('data-locale-save-workflow-failed'), - updateWorkflowFailed: workflowDiv.getAttribute('data-locale-update-workflow-failed'), - deleteWorkflowFailed: workflowDiv.getAttribute('data-locale-delete-workflow-failed'), - atLeastOneActionRequired: workflowDiv.getAttribute('data-locale-at-least-one-action-required'), - }; + const locale = { + defaultWorkflows: workflowDiv.getAttribute('data-locale-default-workflows'), + moveToColumn: workflowDiv.getAttribute('data-locale-move-to-column'), + viewWorkflowConfiguration: workflowDiv.getAttribute('data-locale-view-workflow-configuration'), + configureWorkflow: workflowDiv.getAttribute('data-locale-configure-workflow'), + when: workflowDiv.getAttribute('data-locale-when'), + runWhen: workflowDiv.getAttribute('data-locale-run-when'), + filters: workflowDiv.getAttribute('data-locale-filters'), + applyTo: workflowDiv.getAttribute('data-locale-apply-to'), + whenMovedFromColumn: workflowDiv.getAttribute('data-locale-when-moved-from-column'), + whenMovedToColumn: workflowDiv.getAttribute('data-locale-when-moved-to-column'), + onlyIfHasLabels: workflowDiv.getAttribute('data-locale-only-if-has-labels'), + actions: workflowDiv.getAttribute('data-locale-actions'), + addLabels: workflowDiv.getAttribute('data-locale-add-labels'), + removeLabels: workflowDiv.getAttribute('data-locale-remove-labels'), + anyLabel: workflowDiv.getAttribute('data-locale-any-label'), + anyColumn: workflowDiv.getAttribute('data-locale-any-column'), + issueState: workflowDiv.getAttribute('data-locale-issue-state'), + none: workflowDiv.getAttribute('data-locale-none'), + noChange: workflowDiv.getAttribute('data-locale-no-change'), + edit: workflowDiv.getAttribute('data-locale-edit'), + delete: workflowDiv.getAttribute('data-locale-delete'), + save: workflowDiv.getAttribute('data-locale-save'), + clone: workflowDiv.getAttribute('data-locale-clone'), + cancel: workflowDiv.getAttribute('data-locale-cancel'), + disable: workflowDiv.getAttribute('data-locale-disable'), + disabled: workflowDiv.getAttribute('data-locale-disabled'), + enabled: workflowDiv.getAttribute('data-locale-enabled'), + enable: workflowDiv.getAttribute('data-locale-enable'), + issuesAndPullRequests: workflowDiv.getAttribute('data-locale-issues-and-pull-requests'), + issuesOnly: workflowDiv.getAttribute('data-locale-issues-only'), + pullRequestsOnly: workflowDiv.getAttribute('data-locale-pull-requests-only'), + selectColumn: workflowDiv.getAttribute('data-locale-select-column'), + closeIssue: workflowDiv.getAttribute('data-locale-close-issue'), + reopenIssue: workflowDiv.getAttribute('data-locale-reopen-issue'), + saveWorkflowFailed: workflowDiv.getAttribute('data-locale-save-workflow-failed'), + updateWorkflowFailed: workflowDiv.getAttribute('data-locale-update-workflow-failed'), + deleteWorkflowFailed: workflowDiv.getAttribute('data-locale-delete-workflow-failed'), + atLeastOneActionRequired: workflowDiv.getAttribute('data-locale-at-least-one-action-required'), + }; - const View = createApp(ProjectWorkflow, { - projectLink: workflowDiv.getAttribute('data-project-link'), - eventID: workflowDiv.getAttribute('data-event-id'), - locale, - }); - View.mount(workflowDiv); - } catch (err) { - console.error('Project Workflow failed to load', err); - workflowDiv.textContent = 'Project Workflow failed to load'; - } + const View = createApp(ProjectWorkflow, { + projectLink: workflowDiv.getAttribute('data-project-link'), + eventID: workflowDiv.getAttribute('data-event-id'), + locale, + }); + View.mount(workflowDiv); }