mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 15:48:54 +00:00
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:
@@ -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"'])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ?
|
||||
|
||||
Reference in New Issue
Block a user