From e7c3028ef2336fa33fc89fbeb7783b2d5798b2f0 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 17 Dec 2021 16:27:06 -0800 Subject: [PATCH] fix: Views should be recorded for drafts closes #2862 --- app/models/Document.ts | 2 +- server/models/View.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/models/Document.ts b/app/models/Document.ts index e19fd806b..ebd0dbf04 100644 --- a/app/models/Document.ts +++ b/app/models/Document.ts @@ -276,7 +276,7 @@ export default class Document extends BaseModel { @action view = () => { // we don't record views for documents in the trash - if (this.isDeleted || !this.publishedAt) { + if (this.isDeleted) { return; } diff --git a/server/models/View.ts b/server/models/View.ts index 534f1dde4..e2c76f2ea 100644 --- a/server/models/View.ts +++ b/server/models/View.ts @@ -38,8 +38,7 @@ View.increment = async (where) => { return model; }; -// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'documentId' implicitly has an 'any' typ... Remove this comment to see the full error message -View.findByDocument = async (documentId) => { +View.findByDocument = async (documentId: string) => { return View.findAll({ where: { documentId, @@ -54,8 +53,7 @@ View.findByDocument = async (documentId) => { }); }; -// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'documentId' implicitly has an 'any' typ... Remove this comment to see the full error message -View.findRecentlyEditingByDocument = async (documentId) => { +View.findRecentlyEditingByDocument = async (documentId: string) => { return View.findAll({ where: { documentId,