From f00a38846eaaab1b86bec49f43634eb36bf79ff7 Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Sat, 12 Sep 2026 17:58:51 +0400 Subject: [PATCH] core: fix feed members query for postgres (#7495) * support bot: strip all whitespace after /broadcast * core: fix missing space in feed members query --- apps/simplex-support-bot/bot.test.ts | 5 +++++ apps/simplex-support-bot/src/bot.ts | 2 +- src/Simplex/Chat/Store/Feeds.hs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/simplex-support-bot/bot.test.ts b/apps/simplex-support-bot/bot.test.ts index 7f561dae12..ff7f90cf44 100644 --- a/apps/simplex-support-bot/bot.test.ts +++ b/apps/simplex-support-bot/bot.test.ts @@ -1396,6 +1396,11 @@ describe("/broadcast Command (Team Group)", () => { expect(chat.rawCmds).toEqual(['/feed "line \\"one\\"\\nline two"']) }) + test("/broadcast with extra spaces → text has no leading whitespace", async () => { + await bot.onNewChatItems(teamGroupMessage("/broadcast hello")) + expect(chat.rawCmds).toEqual(['/feed "hello"']) + }) + test("/broadcast on its own line → text starts after the newline", async () => { await bot.onNewChatItems(teamGroupMessage("/broadcast\nline one\nline two")) expect(chat.rawCmds).toEqual(['/feed "line one\\nline two"']) diff --git a/apps/simplex-support-bot/src/bot.ts b/apps/simplex-support-bot/src/bot.ts index 76d031074e..a14a58c11e 100644 --- a/apps/simplex-support-bot/src/bot.ts +++ b/apps/simplex-support-bot/src/bot.ts @@ -857,7 +857,7 @@ export class SupportBot { await this.sendToGroup(teamGroupId, `Error: contact ${senderContactId} is not allowed to broadcast`) return } - const text = (util.ciContentText(chatItem)?.trim() ?? "").replace(/^\/broadcast\s?/, "") + const text = (util.ciContentText(chatItem)?.trim() ?? "").replace(/^\/broadcast\s*/, "") if (text === "") { await this.sendToGroup(teamGroupId, "Error: broadcast text is empty") return diff --git a/src/Simplex/Chat/Store/Feeds.hs b/src/Simplex/Chat/Store/Feeds.hs index db3f8345b9..04919a43d9 100644 --- a/src/Simplex/Chat/Store/Feeds.hs +++ b/src/Simplex/Chat/Store/Feeds.hs @@ -145,6 +145,7 @@ getCustomerGroupsMembersByRange db cxt user@User {userId, userContactId} fromId <$> DB.query db ( groupMemberQuery + <> " " <> [sql| JOIN groups g ON g.group_id = m.group_id WHERE m.user_id = ? AND g.business_chat = ?