mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Fix remaining typescript issues, enable tsc (#32840)
				
					
				
			Fixes 79 typescript errors. Discovered at least two bugs in `notifications.ts`, and I'm pretty sure this feature was at least partially broken and may still be, I don't really know how to test it. After this, only like ~10 typescript errors remain in the codebase but those are harder to solve. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -7,7 +7,7 @@ const reIssueSharpIndex = /^#(\d+)$/; // eg: "#123" | ||||
| const reIssueOwnerRepoIndex = /^([-.\w]+)\/([-.\w]+)#(\d+)$/;  // eg: "{owner}/{repo}#{index}" | ||||
|  | ||||
| // if the searchText can be parsed to an "issue goto link", return the link, otherwise return empty string | ||||
| export function parseIssueListQuickGotoLink(repoLink, searchText) { | ||||
| export function parseIssueListQuickGotoLink(repoLink: string, searchText: string) { | ||||
|   searchText = searchText.trim(); | ||||
|   let targetUrl = ''; | ||||
|   if (repoLink) { | ||||
| @@ -15,13 +15,12 @@ export function parseIssueListQuickGotoLink(repoLink, searchText) { | ||||
|     if (reIssueIndex.test(searchText)) { | ||||
|       targetUrl = `${repoLink}/issues/${searchText}`; | ||||
|     } else if (reIssueSharpIndex.test(searchText)) { | ||||
|       targetUrl = `${repoLink}/issues/${searchText.substr(1)}`; | ||||
|       targetUrl = `${repoLink}/issues/${searchText.substring(1)}`; | ||||
|     } | ||||
|   } else { | ||||
|     // try to parse it for a global search (eg: "owner/repo#123") | ||||
|     const matchIssueOwnerRepoIndex = searchText.match(reIssueOwnerRepoIndex); | ||||
|     if (matchIssueOwnerRepoIndex) { | ||||
|       const [_, owner, repo, index] = matchIssueOwnerRepoIndex; | ||||
|     const [_, owner, repo, index] = reIssueOwnerRepoIndex.exec(searchText) || []; | ||||
|     if (owner) { | ||||
|       targetUrl = `${appSubUrl}/${owner}/${repo}/issues/${index}`; | ||||
|     } | ||||
|   } | ||||
| @@ -33,7 +32,7 @@ export function initCommonIssueListQuickGoto() { | ||||
|   if (!goto) return; | ||||
|  | ||||
|   const form = goto.closest('form'); | ||||
|   const input = form.querySelector('input[name=q]'); | ||||
|   const input = form.querySelector<HTMLInputElement>('input[name=q]'); | ||||
|   const repoLink = goto.getAttribute('data-repo-link'); | ||||
|  | ||||
|   form.addEventListener('submit', (e) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user