fix: Account for non-recorded views, closes #1700
This commit is contained in:
@@ -207,7 +207,7 @@ export default class Document extends BaseModel {
|
||||
@action
|
||||
view = () => {
|
||||
// we don't record views for documents in the trash
|
||||
if (this.isDeleted) {
|
||||
if (this.isDeleted || !this.publishedAt) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@ class MarkAsViewed extends React.Component<Props> {
|
||||
const { document } = this.props;
|
||||
|
||||
this.viewTimeout = setTimeout(async () => {
|
||||
if (document.publishedAt) {
|
||||
const view = await document.view();
|
||||
const view = await document.view();
|
||||
|
||||
if (view) {
|
||||
document.updateLastViewed(view);
|
||||
}
|
||||
}, MARK_AS_VIEWED_AFTER);
|
||||
|
||||
Reference in New Issue
Block a user