fix(irc): store inbound channel routes as channel:#name and join befo… · openclaw/openclaw@63dee51
KaiLi
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -199,4 +199,41 @@ describe("irc inbound behavior", () => {
|
199 | 199 | ).mock.calls[0]?.[0] as { replyPipeline?: unknown } | undefined; |
200 | 200 | expect(assembledRequest?.replyPipeline).toEqual({}); |
201 | 201 | }); |
| 202 | + |
| 203 | +it("uses channel:# prefix for group channel From and OriginatingTo fields", async () => { |
| 204 | +const coreRuntime = createPluginRuntimeMock(); |
| 205 | +setIrcRuntime(coreRuntime as never); |
| 206 | + |
| 207 | +await handleIrcInbound({ |
| 208 | +message: createMessage({ |
| 209 | +target: "#ops", |
| 210 | +isGroup: true, |
| 211 | +senderNick: "alice", |
| 212 | +senderUser: "ident", |
| 213 | +senderHost: "example.com", |
| 214 | +text: "hello", |
| 215 | +}), |
| 216 | +account: createAccount({ |
| 217 | +config: { |
| 218 | +dmPolicy: "open", |
| 219 | +allowFrom: ["*"], |
| 220 | +groupPolicy: "allowlist", |
| 221 | +groupAllowFrom: [], |
| 222 | +groups: { |
| 223 | +"#ops": { enabled: true }, |
| 224 | +}, |
| 225 | +}, |
| 226 | +}), |
| 227 | +config: { channels: { rc: {} } } as CoreConfig, |
| 228 | +runtime: createRuntimeEnv(), |
| 229 | +sendReply: vi.fn(async () => {}), |
| 230 | +}); |
| 231 | + |
| 232 | +const assembledRequest = ( |
| 233 | +coreRuntime.channel.turn.runAssembled as unknown as { mock: { calls: unknown[][] } } |
| 234 | +).mock.calls[0]?.[0] as { ctxPayload?: Record<string, unknown> } | undefined; |
| 235 | +const ctx = assembledRequest?.ctxPayload as Record<string, unknown> | undefined; |
| 236 | +expect(ctx?.From).toBe("channel:#ops"); |
| 237 | +expect(ctx?.OriginatingTo).toBe("channel:#ops"); |
| 238 | +}); |
202 | 239 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。