From 5d3420e9f3377f3988cc209cbedfa69715dd4e3b Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 25 Apr 2023 17:07:06 +0800 Subject: [PATCH 1/5] alert error message --- options/locale/locale_en-US.ini | 1 + routers/web/repo/issue.go | 2 +- web_src/js/features/repo-issue-list.js | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ef9990d265879..ad1abc8f1ed87 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1540,6 +1540,7 @@ issues.dependency.issue_closing_blockedby = Closing this issue is blocked by the issues.dependency.issue_close_blocks = This issue blocks closing of the following issues issues.dependency.pr_close_blocks = This pull request blocks closing of the following issues issues.dependency.issue_close_blocked = You need to close all issues blocking this issue before you can close it. +issues.dependency.issue_batch_close_blocked = `Cannot batch close issues that you choose, because issue (#%[1]d) still has open dependencies` issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it. issues.dependency.blocks_short = Blocks issues.dependency.blocked_by_short = Depends on diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index bea35785bbe01..49ea4f2a1f90c 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2689,7 +2689,7 @@ func UpdateIssueStatus(ctx *context.Context) { if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil { if issues_model.IsErrDependenciesLeft(err) { ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{ - "error": "cannot close this issue because it still has open dependencies", + "error": ctx.Tr("repo.issues.dependency.issue_batch_close_blocked", issue.Index), }) return } diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index 6c5d1244fd7ed..b0502a7e8bb76 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -55,6 +55,8 @@ function initRepoIssueListCheckboxes() { elementId ).then(() => { window.location.reload(); + }).catch((reason) => { + alert(reason.responseJSON.error) }); }); } From 0be8652bc53a45c46d485676b8ff46c2e8768950 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 25 Apr 2023 17:27:51 +0800 Subject: [PATCH 2/5] lint --- web_src/js/features/repo-issue-list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index b0502a7e8bb76..aa4c93a8b75f6 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -56,7 +56,7 @@ function initRepoIssueListCheckboxes() { ).then(() => { window.location.reload(); }).catch((reason) => { - alert(reason.responseJSON.error) + alert(reason.responseJSON.error); }); }); } From 71004f28e9e4002341489aa5b00668625be391f9 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 25 Apr 2023 17:33:36 +0800 Subject: [PATCH 3/5] use window --- web_src/js/features/repo-issue-list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index aa4c93a8b75f6..915cd2e13290c 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -56,7 +56,7 @@ function initRepoIssueListCheckboxes() { ).then(() => { window.location.reload(); }).catch((reason) => { - alert(reason.responseJSON.error); + window.alert(reason.responseJSON.error); }); }); } From e126b6e19dada61a93e48e8facfc0e25d84b3c89 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Wed, 26 Apr 2023 10:00:00 +0800 Subject: [PATCH 4/5] delete useless backticks --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ad1abc8f1ed87..223eb11c3b91c 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1540,7 +1540,7 @@ issues.dependency.issue_closing_blockedby = Closing this issue is blocked by the issues.dependency.issue_close_blocks = This issue blocks closing of the following issues issues.dependency.pr_close_blocks = This pull request blocks closing of the following issues issues.dependency.issue_close_blocked = You need to close all issues blocking this issue before you can close it. -issues.dependency.issue_batch_close_blocked = `Cannot batch close issues that you choose, because issue (#%[1]d) still has open dependencies` +issues.dependency.issue_batch_close_blocked = Cannot batch close issues that you choose, because issue (#%[1]d) still has open dependencies issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it. issues.dependency.blocks_short = Blocks issues.dependency.blocked_by_short = Depends on From e37de075123a77d0dfd70ffa9972d554fbefc923 Mon Sep 17 00:00:00 2001 From: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:55:49 +0800 Subject: [PATCH 5/5] Update options/locale/locale_en-US.ini Co-authored-by: wxiaoguang --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 223eb11c3b91c..d00ba21d05dfd 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1540,7 +1540,7 @@ issues.dependency.issue_closing_blockedby = Closing this issue is blocked by the issues.dependency.issue_close_blocks = This issue blocks closing of the following issues issues.dependency.pr_close_blocks = This pull request blocks closing of the following issues issues.dependency.issue_close_blocked = You need to close all issues blocking this issue before you can close it. -issues.dependency.issue_batch_close_blocked = Cannot batch close issues that you choose, because issue (#%[1]d) still has open dependencies +issues.dependency.issue_batch_close_blocked = "Cannot batch close issues that you choose, because issue #%d still has open dependencies" issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it. issues.dependency.blocks_short = Blocks issues.dependency.blocked_by_short = Depends on