From e57941732a121e30fdf8824bb0214619f333204a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 16 Aug 2022 22:05:10 +0200 Subject: [PATCH] fix: emoji column no longer filled in db, simplified state length validation --- server/models/Document.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index c7f522017..459e0376b 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -222,13 +222,17 @@ class Document extends ParanoidModel { @Column editorVersion: string; + @Length({ + max: 1, + msg: `Emoji must be a single character`, + }) @Column emoji: string | null; @Column(DataType.TEXT) text: string; - @Length({ + @SimpleLength({ max: DocumentValidation.maxStateLength, msg: `Document collaborative state is too large, you must create a new document`, }) @@ -335,7 +339,7 @@ class Document extends ParanoidModel { @BeforeUpdate static processUpdate(model: Document) { - const { emoji } = parseTitle(model.text); + const { emoji } = parseTitle(model.title); // emoji in the title is split out for easier display model.emoji = emoji || null;