From 268f61f0d5daa23c3a03bef62e98ca88e1e51845 Mon Sep 17 00:00:00 2001 From: Simon Planinschek Date: Thu, 23 Jul 2026 19:10:04 +0200 Subject: [PATCH 1/2] lowercase owner and repo name before insert --- src/slack/commands/parse.test.ts | 7 +++++++ src/slack/commands/parse.ts | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/slack/commands/parse.test.ts b/src/slack/commands/parse.test.ts index b5ec36d..903b47b 100644 --- a/src/slack/commands/parse.test.ts +++ b/src/slack/commands/parse.test.ts @@ -49,4 +49,11 @@ describe('parseRepo', () => { test('returns null for empty string', () => { expect(parseRepo('')).toBeNull() }) + + test('lowercases owner and repo', () => { + expect(parseRepo('Torvalds/Linux')).toEqual({ + owner: 'torvalds', + name: 'linux', + }) + }) }) diff --git a/src/slack/commands/parse.ts b/src/slack/commands/parse.ts index 17866e5..8f4440c 100644 --- a/src/slack/commands/parse.ts +++ b/src/slack/commands/parse.ts @@ -15,5 +15,8 @@ export function parseRepo(arg: string): { owner: string; name: string } | null { } const idx = arg.indexOf('/') - return { owner: arg.slice(0, idx), name: arg.slice(idx + 1) } + return { + owner: arg.slice(0, idx).toLowerCase(), + name: arg.slice(idx + 1).toLowerCase(), + } } From 8bf738e0f0f41af09e8f9f3cc1b49790e94c490f Mon Sep 17 00:00:00 2001 From: Simon Planinschek Date: Thu, 23 Jul 2026 19:10:15 +0200 Subject: [PATCH 2/2] sort subscribed repo list --- src/slack/commands/list.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slack/commands/list.ts b/src/slack/commands/list.ts index 3dd5a82..bbf5b02 100644 --- a/src/slack/commands/list.ts +++ b/src/slack/commands/list.ts @@ -1,4 +1,4 @@ -import { eq } from 'drizzle-orm' +import { eq, sql } from 'drizzle-orm' import { buildListBlocks } from '@bot/blocks/list' import { db } from '@db/client' import { repositories, subscriptions } from '@db/schema' @@ -21,6 +21,10 @@ export async function handleList( .from(subscriptions) .innerJoin(repositories, eq(subscriptions.repositoryId, repositories.id)) .where(eq(subscriptions.channelId, ctx.channelId)) + .orderBy( + sql`lower(${repositories.owner})`, + sql`lower(${repositories.repo})`, + ) if (rows.length === 0) { await ctx.respond(