Compare commits

...

6 Commits

Author SHA1 Message Date
Lunny Xiao
05fba3e4d8
Merge 4666bc17e453bef4d676e151fecd79392b51ff16 into b907b9fb1a1a792b9bc25112fa3eb3f8d2fb4397 2025-10-01 12:44:44 +02:00
silverwind
b907b9fb1a
Enable a few more tsconfig options (#35553)
Enable a few more useful options in tsconfig. `noImplicitReturns` had
two cases which I've fixed. Also, partially sort the file.
2025-09-30 21:43:41 -07:00
6543
4666bc17e4
Merge branch 'main' into lunny/milestone_order_due_date 2025-09-07 09:47:15 +02:00
Lunny Xiao
d91604ed2f
Merge branch 'main' into lunny/milestone_order_due_date 2025-09-04 21:30:32 -07:00
Lunny Xiao
1bafbb643d
Consider deadline_unix might be NULL 2025-08-01 21:50:00 -07:00
Lunny Xiao
d86aa76640
Adjust milestone sort order for due date. Non due date mileston will be considered after all due date milestone 2025-08-01 16:23:46 -07:00
5 changed files with 23 additions and 19 deletions

View File

@ -59,7 +59,7 @@ func (opts FindMilestoneOptions) ToConds() builder.Cond {
func (opts FindMilestoneOptions) ToOrders() string {
switch opts.SortType {
case "furthestduedate":
return "deadline_unix DESC"
return "CASE WHEN deadline_unix = 0 OR deadline_unix IS NULL THEN 0 ELSE 1 END, deadline_unix DESC, name ASC"
case "leastcomplete":
return "completeness ASC"
case "mostcomplete":
@ -73,7 +73,7 @@ func (opts FindMilestoneOptions) ToOrders() string {
case "name":
return "name DESC"
default:
return "deadline_unix ASC, name ASC"
return "CASE WHEN deadline_unix = 0 OR deadline_unix IS NULL THEN 1 ELSE 0 END, deadline_unix ASC, name ASC"
}
}

View File

@ -67,7 +67,7 @@ func TestAPIIssuesMilestone(t *testing.T) {
resp = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &apiMilestones)
assert.Len(t, apiMilestones, 4)
assert.Nil(t, apiMilestones[0].Deadline)
assert.Nil(t, apiMilestones[3].Deadline)
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/milestones/%s", owner.Name, repo.Name, apiMilestones[2].Title)).
AddTokenAuth(token)

View File

@ -1,7 +1,7 @@
{
"include": [
"${configDir}/.*",
"${configDir}/*",
"${configDir}/.*",
"${configDir}/tests/e2e/**/*",
"${configDir}/tests/e2e/**/.*",
"${configDir}/tools/**/*",
@ -17,27 +17,31 @@
"allowImportingTsExtensions": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"erasableSyntaxOnly": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": false,
"isolatedModules": true,
"libReplacement": false,
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"verbatimModuleSyntax": true,
"stripInternal": true,
"sourceMap": true,
"strict": false,
"strictBindCallApply": true,
"strictBuiltinIteratorReturn": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": false,
"exactOptionalPropertyTypes": false,
"sourceMap": true,
"stripInternal": true,
"verbatimModuleSyntax": true,
"types": [
"vitest/globals",
"./web_src/js/globals.d.ts",

View File

@ -10,7 +10,7 @@ export function initTableSort() {
}
function tableSort(normSort: string, revSort: string, isDefault: string) {
if (!normSort) return false;
if (!normSort) return;
if (!revSort) revSort = '';
const url = new URL(window.location.href);

View File

@ -43,7 +43,7 @@ type ToastOpts = {
type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast};
/** See https://github.com/apvarun/toastify-js#api for options */
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast | null {
const body = useHtmlBody ? message : htmlEscape(message);
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;
const duplicateKey = preventDuplicates ? (preventDuplicates === true ? `${level}-${body}` : preventDuplicates) : '';
@ -56,7 +56,7 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
showElem(toastDupNumEl);
toastDupNumEl.textContent = String(Number(toastDupNumEl.textContent) + 1);
animateOnce(toastDupNumEl, 'pulse-1p5-200');
return;
return null;
}
}
@ -83,15 +83,15 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
return toast;
}
export function showInfoToast(message: string, opts?: ToastOpts): Toast {
export function showInfoToast(message: string, opts?: ToastOpts): Toast | null {
return showToast(message, 'info', opts);
}
export function showWarningToast(message: string, opts?: ToastOpts): Toast {
export function showWarningToast(message: string, opts?: ToastOpts): Toast | null {
return showToast(message, 'warning', opts);
}
export function showErrorToast(message: string, opts?: ToastOpts): Toast {
export function showErrorToast(message: string, opts?: ToastOpts): Toast | null {
return showToast(message, 'error', opts);
}