mirror of https://github.com/zulip/zulip.git
starred_messages: Validate parameters with Zod.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
9a94cb2269
commit
ce71e5ad8c
|
@ -1,8 +1,9 @@
|
||||||
import * as message_store from "./message_store";
|
import * as message_store from "./message_store";
|
||||||
|
import type {StateData} from "./state_data";
|
||||||
|
|
||||||
export const starred_ids = new Set<number>();
|
export const starred_ids = new Set<number>();
|
||||||
|
|
||||||
export function initialize(starred_messages_params: {starred_messages: number[]}): void {
|
export function initialize(starred_messages_params: StateData["starred_messages"]): void {
|
||||||
starred_ids.clear();
|
starred_ids.clear();
|
||||||
|
|
||||||
for (const id of starred_messages_params.starred_messages) {
|
for (const id of starred_messages_params.starred_messages) {
|
||||||
|
|
|
@ -338,7 +338,7 @@ export const state_data_schema = z
|
||||||
)
|
)
|
||||||
.and(
|
.and(
|
||||||
z
|
z
|
||||||
.object({starred_messages: NOT_TYPED_YET})
|
.object({starred_messages: z.array(z.number())})
|
||||||
.transform((starred_messages) => ({starred_messages})),
|
.transform((starred_messages) => ({starred_messages})),
|
||||||
)
|
)
|
||||||
.and(
|
.and(
|
||||||
|
|
Loading…
Reference in New Issue