From 63c7204c1a71b6c48196736519785033d52d7cd1 Mon Sep 17 00:00:00 2001 From: iliya Date: Tue, 24 Feb 2026 15:07:55 +0200 Subject: [PATCH] fix: notify team lead when team is renamed --- src/main/ipc/teams.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/ipc/teams.ts b/src/main/ipc/teams.ts index e3d0f353..53109998 100644 --- a/src/main/ipc/teams.ts +++ b/src/main/ipc/teams.ts @@ -389,7 +389,8 @@ async function handleUpdateConfig( return { success: false, error: 'color must be a string' }; } return wrapTeamHandler('updateConfig', async () => { - const result = await getTeamDataService().updateConfig(validated.value!, { + const tn = validated.value!; + const result = await getTeamDataService().updateConfig(tn, { name, description, color, @@ -397,6 +398,20 @@ async function handleUpdateConfig( if (!result) { throw new Error('Team config not found'); } + + // Notify running lead about the rename so it stays aware of current team name + if (typeof name === 'string' && name.trim()) { + const provisioning = getTeamProvisioningService(); + if (provisioning.isTeamAlive(tn)) { + const msg = `The team has been renamed to "${name.trim()}". Please use this name when referring to the team going forward.`; + try { + await provisioning.sendMessageToTeam(tn, msg); + } catch { + logger.warn(`Failed to notify lead about team rename for ${tn}`); + } + } + } + return result; }); }