feat: Visually differentiate unread documents (#1507)

* feat: Visually differentiate unread documents

* feat: add document treatment in document preview

* fix requested changes

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Guilherme DIniz
2020-09-21 02:32:28 -03:00
committed by GitHub
parent 4ffc04bc5d
commit d487da8f15
12 changed files with 80 additions and 25 deletions

View File

@ -1,6 +1,6 @@
// @flow
import { takeRight } from "lodash";
import { User, Document, Attachment } from "../models";
import { Attachment, Document, User } from "../models";
import { getSignedImageUrl } from "../utils/s3";
import presentUser from "./user";
@ -62,8 +62,13 @@ export default async function present(document: Document, options: ?Options) {
pinned: undefined,
collectionId: undefined,
parentDocumentId: undefined,
lastViewedAt: undefined,
};
if (!!document.views && document.views.length > 0) {
data.lastViewedAt = document.views[0].updatedAt;
}
if (!options.isPublic) {
data.pinned = !!document.pinnedById;
data.collectionId = document.collectionId;