diff --git a/internal/channels/telegram/commands.go b/internal/channels/telegram/commands.go index 5cfafe64..811a9923 100644 --- a/internal/channels/telegram/commands.go +++ b/internal/channels/telegram/commands.go @@ -58,6 +58,9 @@ func (c *Channel) handleBotCommand(ctx context.Context, message *telego.Message, cmd = strings.SplitN(cmd, "@", 2)[0] + // Inject tenant scope so all command handlers have tenant_id in context. + ctx = store.WithTenantID(ctx, c.TenantID()) + chatIDObj := tu.ID(chatID) // Helper: set MessageThreadID on outgoing messages for forum topics. diff --git a/internal/channels/telegram/commands_tasks.go b/internal/channels/telegram/commands_tasks.go index fa9883a1..02c0dfde 100644 --- a/internal/channels/telegram/commands_tasks.go +++ b/internal/channels/telegram/commands_tasks.go @@ -196,6 +196,9 @@ func (c *Channel) handleTaskDetail(ctx context.Context, chatID int64, text strin // handleCallbackQuery handles inline keyboard button presses. func (c *Channel) handleCallbackQuery(ctx context.Context, query *telego.CallbackQuery) { // Always answer to dismiss the loading indicator. + // Inject tenant scope (callback queries bypass handleBotCommand). + ctx = store.WithTenantID(ctx, c.TenantID()) + c.bot.AnswerCallbackQuery(ctx, &telego.AnswerCallbackQueryParams{ CallbackQueryID: query.ID, })