From 18504de67cb01d8e2715e8471695d49b464d8b3b Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Mon, 22 Apr 2024 17:19:08 +0200 Subject: [PATCH] fix user schema in `encode-url-data.ts` (#550) * Update encode-url-data.ts * f * Create stale-yaks-appear.md --- .changeset/stale-yaks-appear.md | 5 +++++ packages/status-js/src/utils/encode-url-data.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/stale-yaks-appear.md diff --git a/.changeset/stale-yaks-appear.md b/.changeset/stale-yaks-appear.md new file mode 100644 index 00000000..06e88138 --- /dev/null +++ b/.changeset/stale-yaks-appear.md @@ -0,0 +1,5 @@ +--- +"@status-im/js": patch +--- + +fix user schema in `encode-url-data.ts` diff --git a/packages/status-js/src/utils/encode-url-data.ts b/packages/status-js/src/utils/encode-url-data.ts index 05c2dd6d..e1f723e8 100644 --- a/packages/status-js/src/utils/encode-url-data.ts +++ b/packages/status-js/src/utils/encode-url-data.ts @@ -60,7 +60,7 @@ export function decodeChannelURLData(data: string) { const userSchema = z.object({ displayName: z.string().max(24).nonempty(), - description: z.string().max(240).nonempty(), + description: z.string().max(240).optional(), // fixme: await integration in native platforms color: colorSchema.optional().default('#ffffff'), }) @@ -69,7 +69,7 @@ export function encodeUserURLData(data: PlainMessage): EncodedURLData { return encodeURLData(new User(data).toBinary()) as EncodedURLData } -export function decodeUserURLData(data: string): PlainMessage { +export function decodeUserURLData(data: string) { const deserialized = decodeURLData(data) const user = User.fromBinary(deserialized.content).toJson()