Webhooks for the AT Protocol airglow.run
atproto atprotocol automation webhook
12
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: resolve handle with @

Hugo df14ec46 9236d4cc

+8 -8
+6 -6
lib/actions/template.test.ts
··· 258 258 259 259 it("resolves didToHandle in JSON template", async () => { 260 260 const result = await renderTemplate('{"handle":"{{didToHandle(event.did)}}"}', event); 261 - expect(result).toEqual({ handle: "user1.test" }); 261 + expect(result).toEqual({ handle: "@user1.test" }); 262 262 }); 263 263 }); 264 264 ··· 388 388 389 389 it("resolves didToHandle(event.did) to a handle", async () => { 390 390 const result = await renderTextTemplate("Post by {{didToHandle(event.did)}}", event); 391 - expect(result).toBe("Post by user1.test"); 391 + expect(result).toBe("Post by @user1.test"); 392 392 }); 393 393 394 394 it("resolves didToHandle(self) to owner handle", async () => { ··· 398 398 undefined, 399 399 "did:plc:owner", 400 400 ); 401 - expect(result).toBe("By owner.test"); 401 + expect(result).toBe("By @owner.test"); 402 402 }); 403 403 404 404 it("resolves didToHandle with fetch context", async () => { ··· 410 410 event, 411 411 fetchContext, 412 412 ); 413 - expect(result).toBe("Author: author.test"); 413 + expect(result).toBe("Author: @author.test"); 414 414 }); 415 415 416 - it("passes non-DID values through didToHandle as-is", async () => { 416 + it("passes non-DID values through didToHandle with @ prefix", async () => { 417 417 const result = await renderTextTemplate("{{didToHandle(event.commit.record.text)}}", event); 418 - expect(result).toBe("hello"); 418 + expect(result).toBe("@hello"); 419 419 }); 420 420 421 421 it("returns empty string when didToHandle inner arg is undefined", async () => {
+2 -2
lib/actions/template.ts
··· 250 250 if (call?.fn === "didToHandle") { 251 251 const resolved = resolvePlaceholder(call.arg, event, fetchContext, ownerDid); 252 252 if (typeof resolved === "string" && resolved) { 253 - return handleMap.get(resolved) ?? resolved; 253 + return `@${handleMap.get(resolved) ?? resolved}`; 254 254 } 255 255 return ""; 256 256 } ··· 278 278 const resolved = resolvePlaceholder(call.arg, event, fetchContext, ownerDid); 279 279 if (typeof resolved === "string" && resolved) { 280 280 const handle = handleMap.get(resolved) ?? resolved; 281 - return JSON.stringify(handle).slice(1, -1); 281 + return JSON.stringify(`@${handle}`).slice(1, -1); 282 282 } 283 283 return ""; 284 284 }