Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(clients): parse angle-bracketed thread link destinations #30709

MergedScriptedAlchemy(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/30709/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 4 changed files with 28 additions and 1 deletion (loading 1).

x
0 of 4 viewed, 4 left
12 additions and 0 deletionsapps/mobile/src/lib/enrichedLinkPresentation.test.tsModified
View file
@@ -103,4 +103,16 @@
]);
expect(threadChipTargets(here, "No links here.")).toEqual([]);
});
+​
+ it("finds thread links with angle-bracketed destinations", () => {
+ const here = "env-here" as EnvironmentId;
+ expect(threadChipTargets(here, "See [A](<t3-thread://v2/env-here/thread_a>).")).toEqual([
+ {
+ href: "t3-thread://v2/env-here/thread_a",
+ environmentId: here,
+ threadId: "thread_a",
+ link: true,
+ },
+ ]);
+ });
});
1 addition and 1 deletionapps/mobile/src/lib/enrichedLinkPresentation.tsModified
View file
@@ -58,7 +58,7 @@
): ReadonlyArray<ThreadChipTarget> {
const targets = new Map<string, ThreadChipTarget>();
if (hasThreadLinks(markdown)) {
- for (const [, href = ""] of markdown.matchAll(/\]\((t3-thread:\/\/v[12]\/[^\s)]+)\)/g)) {
+ for (const [, href = ""] of markdown.matchAll(/\]\(<?(t3-thread:\/\/v[12]\/[^\s>)]+)>?\)/g)) {
const link = parseThreadLinkHref(href);
if (link) {
targets.set(href, {