Skip to content

Commit

Permalink
fix: optimize fastpr (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyantong2000 authored Nov 10, 2024
1 parent ce9f9a3 commit f1efa11
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
"success_create_pr": "PR created successfully.\nPR URL: {{url}}",
"error_get_user_info": "Failed to get user info: {{status}}",
"error_get_file": "The path is a directory, not a file.",
"error_match_FastPr_Url": "Error executing URL matching function: {{status}}.",
"github_token_not_found": "GitHub token not found.\nPlease enter the token in the Settings page of the extension.",
"gitee_token_not_found": "Gitee token not found.\nPlease enter the token in the Settings page of the extension."
}
1 change: 0 additions & 1 deletion src/locales/zh_CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
"success_create_pr": "PR创建成功。\nPR 地址为: {{url}}",
"error_get_user_info": "获取用户信息失败:{{status}}",
"error_get_file": "该路径是一个目录,而不是文件",
"error_match_FastPr_Url": "执行URL匹配函数出错",
"github_token_not_found": "GitHub 的 token 没有找到。\n请记得在扩展程序的设置页面输入 GitHub token。",
"gitee_token_not_found": "Gitee 的 token 没有找到。\n请记得在扩展程序的设置页面输入 Gitee token。"
}
3 changes: 0 additions & 3 deletions src/pages/ContentScripts/features/fast-pr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ const observeUrlChanges = () => {
window.addEventListener('message', (event: MessageEvent) => {
if (event.data && event.data.matchedUrl) {
init(event.data.matchedUrl);
} else if (event.data && event.data.error) {
const key = 'FastPR';
handleMessage('error', t('error_match_FastPr_Url', { status: event.data.error }), key);
}
});

Expand Down
8 changes: 2 additions & 6 deletions src/pages/Sandbox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ const SandboxApp = () => {
const handleMessage = (event) => {
const { command, url } = event.data;
if (command === 'matchUrl') {
try {
const matchedUrl = window.matchFastPrUrl(url);
event.source.postMessage({ matchedUrl }, event.origin);
} catch (error) {
event.source.postMessage({ error: error.message }, event.origin);
}
const matchedUrl = window.matchFastPrUrl(url);
event.source.postMessage({ matchedUrl }, event.origin);
}
};

Expand Down

0 comments on commit f1efa11

Please sign in to comment.