core: fix feed members query for postgres (#7495)

* support bot: strip all whitespace after /broadcast

* core: fix missing space in feed members query
This commit is contained in:
sh
2026-09-12 14:58:51 +01:00
committed by GitHub
parent 03c8bf5add
commit f00a38846e
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -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"'])
+1 -1
View File
@@ -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
+1
View File
@@ -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 = ?