⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix: preserve Unicode characters in activity excerpts
Tin262db234bfef
diff --git a/apps/api/src/activity/comment-excerpt.test.ts b/apps/api/src/activity/comment-excerpt.test.tsindex 02953ea13..f6e3957d2 100644--- a/apps/api/src/activity/comment-excerpt.test.ts+++ b/apps/api/src/activity/comment-excerpt.test.ts@@ -28,6 +28,13 @@ describe("commentExcerpt", () => {expect(excerpt?.endsWith("…")).toBe(true);});+ it("keeps surrogate pairs intact at the excerpt boundary", () => {+ const prefix = "a".repeat(238);+ expect(commentExcerpt(`${prefix}😀tail`)).toBe(`${prefix}😀…`);+ const atLimit = "😀".repeat(240);+ expect(commentExcerpt(atLimit)).toBe(atLimit);+ });+it("returns null when nothing readable is left", () => {expect(commentExcerpt(null)).toBeNull();expect(commentExcerpt("")).toBeNull();diff --git a/apps/api/src/activity/comment-excerpt.ts b/apps/api/src/activity/comment-excerpt.tsindex c8161058d..b1fd46ea0 100644--- a/apps/api/src/activity/comment-excerpt.ts+++ b/apps/api/src/activity/comment-excerpt.ts@@ -13,6 +13,15 @@ export function commentExcerpt(content: string | null): string | null {.trim();if (!text) return null;- if (text.length <= EXCERPT_LENGTH) return text;- return `${text.slice(0, EXCERPT_LENGTH - 1).trimEnd()}…`;+ const characters: string[] = [];+ for (const character of text) {+ characters.push(character);+ if (characters.length > EXCERPT_LENGTH) {+ return `${characters+ .slice(0, EXCERPT_LENGTH - 1)+ .join("")+ .trimEnd()}…`;+ }+ }+ return text;}