mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(slack): expose sender bot status in context (#97822)
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
co-authored by
Vincent Koc
parent
37341a7032
commit
5c4e478df4
@@ -1060,6 +1060,26 @@ Second paragraph should still reach the agent after Slack's preview cutoff.`;
|
||||
expect(members).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("forwards bot sender status to ctxPayload when allowBots admits the bot", async () => {
|
||||
const { slackCtx } = createOwnerScopedBotRoomCtx({ members: ["UOWNER"] });
|
||||
|
||||
const prepared = await prepareMessageWith(
|
||||
slackCtx,
|
||||
createSlackAccount({ allowBots: true }),
|
||||
createBotRoomMessage(),
|
||||
);
|
||||
|
||||
assertPrepared(prepared);
|
||||
expect(prepared.ctxPayload.SenderIsBot).toBe(true);
|
||||
});
|
||||
|
||||
it("omits SenderIsBot for human messages", async () => {
|
||||
const prepared = await prepareWithDefaultCtx(createSlackMessage({ text: "hello" }));
|
||||
|
||||
assertPrepared(prepared);
|
||||
expect(prepared.ctxPayload.SenderIsBot).toBeUndefined();
|
||||
});
|
||||
|
||||
it("allows bot-authored room messages when the bot is explicitly channel-allowlisted (#59284)", async () => {
|
||||
const members = vi.fn();
|
||||
const slackCtx = createInboundSlackCtx({
|
||||
|
||||
@@ -1271,6 +1271,7 @@ export async function prepareSlackMessage(params: {
|
||||
id: senderId,
|
||||
name: senderName,
|
||||
displayLabel: senderName,
|
||||
isBot: isBotMessage || undefined,
|
||||
},
|
||||
conversation: {
|
||||
kind: chatType,
|
||||
|
||||
Reference in New Issue
Block a user