{"record":{"id":"afc60a7255a91d6d","repo":"hcengineering/platform","slug":"not-implemented-afc60a","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/telegram-resources/src/utils.ts","lineNumber":35,"sourceCode":"import { getContactChannel } from '@hcengineering/contact-resources'\nimport { getClient } from '@hcengineering/presentation'\nimport { type TemplateDataProvider } from '@hcengineering/templates'\nimport { getMetadata } from '@hcengineering/platform'\n\nimport telegram from './plugin'\n\nexport async function getCurrentEmployeeTG (): Promise<string | undefined> {\n  const me = getCurrentEmployee()\n  const client = getClient()\n  const employee = await client.findOne(contact.mixin.Employee, { _id: me })\n  if (employee !== undefined) {\n    return await getContactChannel(employee, contact.channelProvider.Telegram)\n  }\n}\n\nexport async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {\n  // TODO: FIXME\n  throw new Error('Not implemented')\n  // const value = provider.get(setting.class.Integration)\n  // if (value === undefined) return\n  // const client = getClient()\n  // const employeeAccount = await client.findOne(contact.class.PersonAccount, {\n  //   _id: value.modifiedBy as PersonId\n  // })\n  // if (employeeAccount !== undefined) {\n  //   const employee = get(employeeByIdStore).get(employeeAccount.person as Ref<Employee>)\n  //   if (employee !== undefined) {\n  //     return await getContactChannel(employee, contact.channelProvider.Telegram)\n  //   }\n  // }\n}\n\nexport function isTelegramNotificationsAvailable (): boolean {\n  const botEndpoint = getMetadata(telegram.metadata.BotUrl) ?? ''\n\n  return botEndpoint !== ''","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/telegram-resources/src/utils.ts#L17-L53","documentation":"getIntegrationOwnerTG is a placeholder: it immediately throws Error('Not implemented') and the rest of the intended implementation is commented out behind a TODO:FIXME. Any template/provider resolution that needs the Telegram integration owner will always fail until the function is implemented.","triggerScenarios":"Any code path that calls getIntegrationOwnerTG — e.g. building notification templates that need the integration owner account — regardless of arguments; the error is unconditional.","commonSituations":"Enabling Telegram notification templates in a build where this helper was never finished; upgrades where a feature depends on this unfinished utility.","solutions":["Implement the function per the commented-out sketch: resolve the Integration setting, find the PersonAccount by modifiedBy, and return the owner identifier","Avoid calling getIntegrationOwnerTG until the feature is implemented; gate the calling feature behind a flag","Patch/wrap it locally with a working implementation using provider.get(setting.class.Integration) and contact.class.PersonAccount lookup","Track upstream for the FIXME resolution and update"],"exampleFix":"// before\nexport async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {\n  throw new Error('Not implemented')\n}\n// after\nexport async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {\n  const value = provider.get(setting.class.Integration)\n  if (value === undefined) return\n  const client = getClient()\n  const account = await client.findOne(contact.class.PersonAccount, { _id: value.modifiedBy as PersonId })\n  return account?.name ?? account?._id\n}","handlingStrategy":"fallback","validationCode":"// Cannot validate: function always throws. Feature-detect by avoiding the call:\nconst isTelegramOwnerSupported = false // until FIXME is resolved upstream\nif (isTelegramOwnerSupported) {\n  owner = await getIntegrationOwnerTG(provider)\n}","typeGuard":null,"tryCatchPattern":"let owner: string | undefined\ntry {\n  owner = await getIntegrationOwnerTG(provider)\n} catch (err) {\n  if (err instanceof Error && err.message === 'Not implemented') {\n    owner = undefined // degrade gracefully: render template without owner\n  } else {\n    throw err\n  }\n}","preventionTips":["Do not build features on functions marked TODO:FIXME","Wrap unimplemented utilities behind capability flags checked at runtime","Track upstream fixes and remove the workaround once implemented"],"tags":["not-implemented","unimplemented-feature","telegram"],"backgroundTag":"not-implemented","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}