fix user schema in `encode-url-data.ts` (#550)
* Update encode-url-data.ts * f * Create stale-yaks-appear.md
This commit is contained in:
parent
13f7ed5415
commit
18504de67c
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@status-im/js": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix user schema in `encode-url-data.ts`
|
|
@ -60,7 +60,7 @@ export function decodeChannelURLData(data: string) {
|
||||||
|
|
||||||
const userSchema = z.object({
|
const userSchema = z.object({
|
||||||
displayName: z.string().max(24).nonempty(),
|
displayName: z.string().max(24).nonempty(),
|
||||||
description: z.string().max(240).nonempty(),
|
description: z.string().max(240).optional(),
|
||||||
// fixme: await integration in native platforms
|
// fixme: await integration in native platforms
|
||||||
color: colorSchema.optional().default('#ffffff'),
|
color: colorSchema.optional().default('#ffffff'),
|
||||||
})
|
})
|
||||||
|
@ -69,7 +69,7 @@ export function encodeUserURLData(data: PlainMessage<User>): EncodedURLData {
|
||||||
return encodeURLData(new User(data).toBinary()) as EncodedURLData
|
return encodeURLData(new User(data).toBinary()) as EncodedURLData
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decodeUserURLData(data: string): PlainMessage<User> {
|
export function decodeUserURLData(data: string) {
|
||||||
const deserialized = decodeURLData(data)
|
const deserialized = decodeURLData(data)
|
||||||
|
|
||||||
const user = User.fromBinary(deserialized.content).toJson()
|
const user = User.fromBinary(deserialized.content).toJson()
|
||||||
|
|
Loading…
Reference in New Issue